I have a development server running (and serving content) using the built in django server. All my templates that are rendered from generic views point correctly to the static media files (css/java/imgs) but ones that are rendered via custom views don't seem to prepend the /media/ folder to the urls. (At least this seems to be the proble...
Im trying to setup situation where users of application can do statistical analysis of data.
There are 3 tables, users, exams, polls
I should have gui to build custom queries, like these:
users born between 1930 and 1940, that have 3 exams taken; show
name, surname, group by age of person
count of users born 1945 that have not taken...
Hi, i'm trying to get model objects instance in another one. And i raise this error :
Manager isn't accessible via topic instance
Here's my model :
class forum(models.Model):
# Some attributs
class topic(models.Model):
# Some attributs
class post(models.Model):
# Some attributs
def delete(self):
forum = se...
I hope this hasn't been asked and I just missed it, but I searched a bunch and couldn't find anything.
I'm adding an extra save button to the django admin when adding or changing an object. Doing that is fairly easy. I just overrode the submit_line.html to add the extra button and then overrode the save_model function to check for the ...
Hi, I have a little problem with the context.
I have an inclusion tag with the param :
takes_context=True
In this inclusion's tag's template, I call for another inclusion_tag which has also the param
takes_context = True
But in this last inclusion_tag context is None.
I don't know why ?
Thanks.
...
In development, it's a bit of a hassle to run the celeryd as well as the Django development server. Is it possible to, for example, ask celery to run tasks synchronously during development? Or something similar?
...
I have a modelform that will either create a new model or edit an existing one - this is simple and should work, but for some reason I'm getting a new instance every time.
The scenario is this is the first step in an ecommerce order. The user must fill out some info describing the order (which is stored in the model). I create the model...
So, I have a form:
class FormBasicInfo(BasicForm):
valid_from = forms.DateField(required=False, input_formats=('%d/%m/%Y',), widget=DateInput(format='%d/%m/%Y'))
and I set the input and output formats. However, what if I want to set these formats at runtime, based on the date format preference of my user? how can that be done?
T...
What are the factors you would consider when choosing between Socket.io and Pusherapp?
http://Socket.io
http://pusherapp.com
Important considerations includes: integration w existing systems like rails/django, ease of setup, ease of development
...
I have an app which includes a model "QuesTags". Now when I create an entry for this model in admin.py, the admin displays this model as "Ques tagss", which IMHO is totally unpalatable. Is there a way around( ex. short_description ) to display a custom string instead of parsing the original model name?
...
I've got a chicken and egg problem here. Firstly I've got a userprofile class which builds upon the default user model of django.
class UserProfile(models.Model):
def __unicode__(self):
return self.user.username
user = models.OneToOneField(User, unique=True)
exam = models.ForeignKey('questions.Exam', null=True)
Nex...
I am working on a Google App Engine application and I am relatively new at this.
I have built an app already in Django and have a model using a field type of ManyToMany.
I am aware that django-nonrel does not support many-to-many field types of Django. So I am considering using ListField instead.
Questions:
- What is the implication ...
I am relatively new to django. I have defined my db schema and validated it with no errors (manage.py validate reports 0 errors found).
Yet when I run ./manage.py syncdb
I get the following stack trace:
Creating table demo_foobar_one
Creating table demo_foobar_two
<snip>...</snip>
Traceback (most recent call last):
File "manage.py"...
I've got this complex filtering mechanism...
d = copy(request.GET)
d.setdefault('sort_by', 'created')
d.setdefault('sort_dir', 'desc')
form = FilterShipmentForm(d)
filter = {
'status': ShipmentStatuses.ACTIVE
}
exclude = {}
if not request.user.is_staff:
filter['user__is_staff'] = False
if request.user.is_authenticated():
ex...
I've got a problem here. I've got three models, A, B and C.
Class A
Class B
fb = foreignkey(A)
Class C
fc = foreignkey(B)
In admin.py I'm doing something like
AdminA
inlines = [inlineB]
AdminB
inlines = [inlineC]
The troubles start appearing on Add page of Model A. Basically, Model B is just a placeholder for di...
I have a form which submits and saves some data to the database. After the submit process, I have the view for the form re-display a summary page which lists items in the database using the following:
return HttpResponseRedirect(reverse("my_shows"))
reverse("my_shows") leads to a view which gets the relevant objects from the database...
Guys,
How can i see my django queries from manage shell interface
I have tried using this but gives me queries that pass through the django server
from django.db import connection
connection.queries()
I have seen it somewhere, can't remember where??
help
Gath
...
When using 'db_table' to explicitly set the database table name, how can you preserve the naming convention of "app_table_name"? The app name is removed.
...
Hello ! One more question about Django concerning localization of javascript files.
Django provides a small and convenient javascript library which is used like gettext to internationalize strings in javascript files.
I set it up successfully (at least the interpolate function works) and I could generate the po file for the French lang...
I'm trying to make a copy of a FeinCMS page tree, which is managed using django-mptt. I wrote this function:
def make_tree_copy(page, parent=None):
'''
Makes a copy of the tree starting at "page", reparenting it to "parent"
'''
new_page = Page.objects.create_copy(page)
new_page.save()
Page.tree.move_node(new_page...