Lets say I have an application with a structure such as:
System
set date
set name
set something
Other
set death ray target
calibrate
and I want to have "back" and "next" buttons on a page. The catch is, if you're going in via the "wizard", I want the nav path to be something like "set name" -> "set death ray target" -> "set ...
So I have a Django app that processes test results, and I'm trying to find the median score for a certain assessment. I would think that this would work:
e = Exam.objects.all()
total = e.count()
median = int(round(total / 2))
median_exam = Exam.objects.filter(assessment=assessment.id).order_by('score')[median:1]
median_score = median_ex...
I have a model form that I use to update a model.
class Turtle(models.Model):
name = models.CharField(max_length=50, blank=False)
description = models.TextField(blank=True)
class TurtleForm(forms.ModelForm):
class Meta:
model = Turtle
Sometimes I don't need to update the entire model, but only want to update one o...
Hi all,
I have the following problem:
I have two models: Article and Comment, in Comments, i have parent = models.ForeignKey(Article). I have it set up so that Comments is inline to ArticleAdmin(admin.ModelAdmin), and CommentInline(admin.StackedInline). What i would like is that for Article list view (elements chosen in list_display), ...
I just started playing with Django today and so far am finding it rather difficult to do simple things. What I'm struggling with right now is filtering a list of status types. The StatusTypes model is:
class StatusTypes(models.Model):
status = models.CharField(max_length=50)
type = models.IntegerField()
def __unicode__(self)...
Hi. Previously I've been using some older version of django-registration which seems to be deprecated now. Because my server does not allow me to install python plugins I need to use 'registration' as separate django application. Now my question is what do I need to modify in order to get registation running as django-app ? Can I just co...
I'm having a attribute on my model to allow the user to order the objects. I have to update the element's order depending on a list, that contains the object's ids in the new order; right now I'm iterating over the whole queryset and set one objects after the other. What would be the easiest/fastest way to do the same with the whole quer...
Hi all,
I have a similar problem as a previously solved problem of mine, except this time solution doesn't seem to work:
http://stackoverflow.com/questions/2991365/how-to-auto-insert-the-current-user-when-creating-an-object-in-django-admin
Previously i used to override the save_model to stamp the user submitting the article. Now i nee...
Hi All,
I've recently been developing on the django platform and have stumbled upon Django Forms (forms.Form/forms.ModelForm) as ways of creating <form> html.
Now, this is brilliant for quick stuff but what I'm trying to do is a little bit more complicated. Consider a DateField - my current form has fields for day, month and year and c...
I have a set of Django models as shown in the following diagram (the names of the reverse relationships are shown in the yellow bubbles):
In each relationship, a Person may have 0 or more of the items.
Additionally, the slug field is (unfortunately) not unique; multiple Person records may have the same slug fields. Essentially these ...
Hi all,
I have Article model and a Comment model. Comment is created in admin.py as admin.StackedInline, and it has several fields, notably content and lastUpdate. For lastUpdate, i have specified as follows: lastUpdate = models.DateTimeField('last update', auto_now=True). Understandably, lastUpdate is not displayed when i try to add ne...
Hi all,
So i have an Article model, in there, there is a submitter = models.ForeignKey(User). When i do list_display on this submitter in ArticleAdmin, i would like to display the user's first name instead of the default (his username). How would i go about doing this?
Thanks a lot!
Jason
...
Sometimes I need to UNREGISTER some ModelAdmins from the admin site, because I don't want them to be there as they are, eg. if I'm using the Sites framework, and I dont want it to appear in the admin. It's no big deal to e.g. call admin.site.unregister(Site) to do so. In most cases I put it in admin.py of some related app that I have mad...
A little premise:
I'm on a diet and I'm trying to draw a chart of my weight loss.
To do that, I'm using a little django app to store the weight readings, and gRaphael (http://g.raphaeljs.com/) charting library to draw the reports.
You can see the wip here: http://www.totanus.net/weight/
At this time I'm printing dates in the X-axis usi...
Hi folks,
I'm using popen in order to send a few commands within a Django app.
Problem is that I'm getting [Error 5] Access Denied, apparently I have no access to cmd.exe, which popen seems to use.
WindowsError at /test/cmd/
[Error 5] Access is denied: 'C:\WINDOWS\system32\cmd.exe /c dir'
I reckon this is because the app sit...
I have a model with ManyToManyField to another model. I would like to get all the info on a particular record (including the related info from other models) return by JSON.
How to get django-piston to display those values? I would be happy with just primary keys.
Or can you suggest another option ?
...
What is the best Django syncdb crash debugging technique ?
I've previously asked a question about a problem with manage.py syncdb returning an exception
and the answer was that the app has a wrong import.
http://stackoverflow.com/questions/2734721/django-manage-py-syncdb-not-working
I'd like to know the technique used to find the plac...
I'm running a Django project on Postgresql 8.1.21 (using Django 1.1.1, Python2.5, psycopg2, Apache2 with mod_wsgi 3.2). We've recently encountered this lovely error:
OperationalError: FATAL: connection limit exceeded for non-superusers
I'm not the first person to run up against this. There's a lot of discussion about this error, speci...
My mod_wsgi django application seems to keep getting reloaded for the first several requests that the client makes. This is killing my performance
After enough requests it seems to settle down, and the application no longer seems to be getting reloaded. Any thoughts on why this is happening and how I can prevent it?
(I have the followi...
I'm trying to set up jsTree to dynamically accept JSON data from django.
This is the test data i have django returning to jstree:
result=[{ "data" : "A node", "children" : [ { "data" : "Only child", "state" : "closed" } ], "state" : "open" },"Ajax node"]
response=HttpResponse(content=result,mimetype="application/json")
this is the js...