django

Is it possible to get the value of an item contained in Django's "changed_data" list?

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? ...

Best Practice for following Subversion repository Trunk: Git (Mirror), Git-Svn, Subversion?

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...

Django: Arbitrary number of unnamed urls.py parameters

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'...

"is_logged_in" templatetag does not render

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...

What do you like about Django?

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...

What is the best way to serve static web pages from within a django app?

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...

In django, how do I sort a model on a field and then get the last item?

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] ...

Why won't Django 1.0 admin application work?

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...

Full outer join in django

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...

designing model structure for django

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 to embed a tag within a url templatetag in a django template?

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...

Django - filtering on related objects

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...

'Snippit' based django semi-CMS

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...

Can anybody comment on django-wapi?

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...

Django models - how to filter number of ForeignKey objects

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 ...

Django: Overriding verbose_name for AutoField without dropping the model.

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" ...

Where can i get a good free css editor?

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? ...

How do I use CSS 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 ...

custom HTTP headers for static files with Django

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...

Django Forms, Display Error on ModelMultipleChoiceField

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...