I have the following code in my Django application:
if 'book' in authorForm.changed_data:
#Do something here...
I realize Django can tell me which values have changed in my form by utilizing the "changed_data" list object, but I'd like to know the new values of the fields that have changed.
Any thoughts?
...
I want to checkout, and then update as necessary, the Django Subversion trunk on a Mac OS X Leopard 10.5.5 machine.
I am only interested in having updated Django code on my Mac. I am not interested in contributing patches to the Django project. I do not need the Subversion history for the Django trunk.
I plan to use Git as the DVCS/SC...
I have a Django model with a large number of fields and 20000+ table rows. To facilitate human readable URLs and the ability to break down the large list into arbitrary sublists, I would like to have a URL that looks like this:
/browse/<name1>/<value1>/<name2>/<value2>/ .... etc ....
where 'name' maps to a model attribute and 'value'...
for some reason, templatetags do not render in templates for django admin.
with this snippet from:
http://docs.djangoproject.com/en/dev/ref/templates/api/?from=olddocs#shortcut-for-simple-tags
{% if is_logged_in %}Thanks for logging in!{% else %}Please log in.{% endif %}
when placed in admin index.html, if a user is logged in, it sho...
I started to learn Django a few days ago, and as i dive into it it seems that I'm starting to like it even more.
Trying to migrate from other language.
I won't say which one, as the purpose of this question is not to bash anything.
So i would like to know your opinion about Django.
What do you like about it?
What made you switch/use...
I am building a relatively simple django app and apart from the main page where most of the dynamic parts of the application are, there are a few pages that I will need that will not be dynamic at all (About, FAQ, etc.). What is the best way to integrate these into django, idealing still utilizing the django template engine? Should I jus...
Specifically, I have a model that has a field like this
pub_date = models.DateField("date published")
I want to be able to easily grab the object with the most recent pub_date. What is the easiest/best way to do this?
Would something like the following do what I want?
Edition.objects.order_by('pub_date')[:-1]
...
I've just started playing with Django and am loosely following the tutorial with my own set of basic requirements. The models I've sketched out so far are a lot more comprehensive than the tutorial, but they compile fine. Otherwise, everything should have been the same.
My problem is with the admin application. I can log into it, and vi...
How can I create a query for a full outer join across a M2M relationchip using the django QuerySet API?
It that is not supported, some hint about creating my own manager to do this would be welcome.
Edited to add:
@S.Lott:
Thanks for the enlightenment.
The need for the OUTER JOIN comes from the application. It has to generate a report...
Hi,
I'm trying to design a model for a application allowing 2 people to bet with each other (I know, sounds stupid...). What I'm wondering about is how to connect the bet with users. The structure is like this
|-------------| |----------|
| Bet | | User |
| BetUser1 | |----------|
| BetUser2 |
| Winn...
How do I embed a tag within a url templatetag in a django template?
Django 1.0 , Python 2.5.2
In views.py
def home_page_view(request):
NUP={"HOMEPAGE": "named-url-pattern-string-for-my-home-page-view"}
variables = RequestContext(request, {'NUP':NUP})
return render_to_response('home_page.html', variables)
In home_page...
For my Django app I have Events, Ratings, and Users. Ratings are related to Events and Users through a foreign keys. When displaying a list of Events I want to filter the ratings of the Event by a user_id so I know if an event has been rated by the user.
If I do:
event_list = Event.objects.filter(rating__user=request.user.id)
(requ...
I remember reading somewhere on the internets about a half-assed tiny django CMS app, which was basically built on 'snippets' of text.
The idea was, that in the admin, you make a snippet (say a description of a product), give it a name (such as 'google_desc') and call it in a template with something like {% snippet google_desc %} and ba...
Aside for a few user guides found at http://fi.am/en/tag/django/2/ I have not managed to find much about WAPI.
I was wondering if anyone has had an experience using WAPI and django to create a web api?
I'm a little intimidated by the amount of magic these frameworks seem to do.
Are there any other good alternatives to creating a web ap...
I have a models A and B, that are like this:
class A(models.Model):
title = models.CharField(max_length=20)
(...)
class B(models.Model):
date = models.DateTimeField(auto_now_add=True)
(...)
a = models.ForeignKey(A)
Now I have some A and B objects, and I'd like to get a query that selects all A objects that have less then 2 ...
I am using 0.97-pre-SVN-unknown release of Django.
I have a model for which I have not given any primary_key. Django, consequently, automatically provides an AutoField that is called "id". Everything's fine with that. But now, I have to change the "verbose_name" of that AutoField to something other than "id". I cannot override the "id" ...
Am developing my web application using Django, and is seems CSS is the only way i can format my pages to look and feel nice. Where can i get a free and good css editor?
NB: Is there another way to format forms in Django?
...
I am creating my application using Django, and am wondering how I can make Django use my CSS file? What settings do I need to do to make Django see the css file?
NB: On a local machine
...
I'm writing an image bank with Django, and I want to add a button to get a hi-res version of an image (the low-res is shown in the details page). If I put just an <a> link, the browser will open the image instead of downloading it. Adding an HTTP header like:
Content-Disposition: attachment; filename="beach008.jpg"
works, but since...
I'm having an issue getting validation error messages to display for a particular field in a Django form, where the field in question is a ModelMultipleChoiceField.
In the clean(self) method for the Form, I try to add the error message to the field like so:
msg = 'error'
self._errors['field_name'] = ErrorList([msg])
raise forms.Validat...