I have a route defined as follows:
(r'^edit/(\d+)/$', 'app.path.edit')
I want to use the reverse function as follows:
url = reverse('app.path.edit', args=('-id-',))
The generated url gets passed to a js function, and client side code will eventually replace '-id-' with the correct numeric id. This of course won't work, because the ...
Hello anyone,
I have django-registration installed. I just updated my Python installation from 2.5 to 2.7.
Everything works okay but when I try to run my Django app, I get the error below.
C:\django\pley>python manage.py runserver
Validating models...
Unhandled exception in thread started by <function inner_run at 0x02FA6830>
Tracebac...
Here is a snippet of how my models are setup:
class Profile(models.Model):
name = models.CharField(max_length=32)
accout = models.ManyToManyField(
'project.Account',
through='project.ProfileAccount'
)
def __unicode__(self)
return self.name
class Accounts(models.Model):
name = models.Ch...
I'm trying to get a query from a specific model. I'm having trouble getting it to filter the data correctly.
I've already fixed one bug where it was returning other users data but now its returning duplicates of one row of data in the model.
events = Event.objects.filter(club=user.get_profile().main_club) | Event.objects.filter(invclu...
Hi all,
I have a situation where I've overrided the admin_change.html template for a given model. I've created a file such as:
/myproject/templates/admin/myapp/mymodel/change_form.html
Then, in the overrided change_form.html template, where I am editing an existing object instance, I want to have access to that model instance varia...
My django-sorting results are pathetic. Won't sort the data in the entire Queryset because djangos pagination model slices it.
Any know a way around this?
More details:
http://code.google.com/p/django-pagination/issues/detail?id=37
...
I'm working with Django project on Linux and Windows. So I'm trying to config 'settings.py' to work on both platforms.
I can config the template dirs as:
TEMPLATE_DIRS = (
'c:/artefacts/workspace/BookMixToFb2/src/templates',
'/home/demas/workspace/BookMixToFb2/src/templates'
)
and this will be work on linux and windows.
But ...
i am working with a django quiz application where one question per page. when i will answer one question selecting a radio button and click submit button how can i get the next question in the next page as well as the answer will submitted to database. If anyone help me it would be an outstanding solution for me. please
Thanks for the...
Hi guys,
This problem has been bugging me for the last week or so and now I am coming up on a deadline. I have a site on a Media Temple DV server that is running Drupal in the webroot (servername.org). I am adding a django site and I would like it to be located at the url servername.org/myproject. I have build the project (in a directory...
I have a system for composing items from parts in certain categories
For instance take the following categories:
1: (Location)
2: (Material)
And the following parts:
Wall (FK=1)
Roof (FK=1)
Roof (FK=1)
Brick (FK=2)
Tile (FK=2)
Wood (FK=2)
To compose these items:
Wall.Brick, Roof.Wood, Wall.Wood
class Category(models.Model):
...
For my final year project I plan to code a cloud in Python. The client will be written in Java by the other member of my team. The client will have a tabbed interface and it will provide a text editor, a media player, a couple of small Java based games and a maybe a few more services.
The server will work like this:
1) Validate the...
Maybe my question is little childish. A django model is typically defined like this:
class DummyModel(models.Model):
field1 = models.CharField()
field2 = models.CharField()
As per my understanding, field1 and field2 are defined on the class level instead of instance level. So different instances will share the same field value...
I have a Django model, shown below, that I use to keep track of which ip addresses visit my site and when.
class Visit(models.Model):
created = models.DateTimeField(default=datetime.utcnow)
ip = models.IPAddressField(editable=False)
I'd like to write a method on this model that returns the number of days i...
I want to load fixtures into django. The data has some date fields - is it possible to create these data so they will always be e.g. yesterday or tomorrow? I want to make sure certain data is always fresh, but also so I can easily test edge cases (e.g. whether an object is enabled if the publishing date is today, etc).
...
So I just updated django to 1.2.3 and now when I try to run 'python manage.py shell' to work in the django environment, I'm getting the following error.
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2...
I am trying out Sphinx search in my Django project. All setup done & it works but need some clarification from someone who has actually used this setup.
In my Sphinx search while indexing, I have used 'name' as the field in my MySQL to be searchable & all other fields in sql_query to be as attributes (according to Sphinx lingo).
So wh...
I am relatively new to Django/Pinax & I am faced with this peculiar situation.
Say I have a model "Vehicle". Now each instance of "Vehicle" has some attributes pertaining to the "vehicle" but it also has a reference to instance of one of automobiles class, where "automobiles" can be one of the many models like "car", "boat", "plane" etc...
I have a relatively simple site on my hands, and have for nearly a year, but I can't seem to find a platform to build it on that doesn't fight back at the way I want to do things. Here are the key features:
Customizable profiles. Profile tags.
Two primary content types: Haves & Wants
Both content types searchable/taggable and expire wi...
I'm working a small, personal Django project and I've added South (latest mercurial as of 10/9/10) to my project.
However, whenever I run "./manage.py syncdb" or "./manage.py migrate " I get about 13 pages (40 lines each) of output solely regarding 'initial_data' files not being found. I don't have any initial_data nor do I really want ...
Hey guys,
Maybe i am missing something, but according to the django docs (1.2), i have setup my URLS, models exactly as specified to ensure i am not hard-coding urls returned for get_absolute_url.
Here's what i have:
in urls.py
urlpatterns = patterns('django.views.generic.list_detail',
url(r'^$','object_list',
{ 'que...