- How to specify a multiple field primary key? It is complicated, but what we can do is to specify a set of fields to be unique in the meta class of our model.
http://docs.djangoproject.com/en/dev/ref/models/options/#unique-together
- Dynamic Django Queries
- How can I make request.session parameters visible to a template without passing them as a parameter?
- A good way to customize templates for visualizing forms and form errors:
- A free online book which explains Django:
- How to navigate in a template in a one-to-many relation:
- A tutorial to build a first application in Django, in four steps:
- Query sets in Django. How can we use a field of a related object inside a filter? With object1.filter(obect2__field="aaa")
- A person who gave up Django explains its reasons:
- The Catalan Django group:
- A Django users Google Groups group
- A comparison of CMSApplications for Django
- How to pass initial values to a form without validating it?
The general explanation of form fields is here:
http://docs.djangoproject.com/en/dev/ref/forms/fields/
- Where can we host our Django application? A list of the most popular webs and its prices:
- Using reverse() in HttpResponseRedirect to avoid having to hardcode a URL in the view function:
- Changing the Model Choice Field Queryset:
from django import newforms as forms
from django.contrib.auth.models import User
class ComplaintForm(forms.Form):
user = forms.ModelChoiceField(queryset=User.objects.none())
message = forms.CharField(widget=forms.Textarea())
def __init__(self, *args, **kwargs):
super(ComplaintForm, self).__init__(*args, **kwargs)
self.fields["user"].queryset = User.objects.filter(is_staff=False)
http://oebfare.com/blog/2008/feb/23/changing-modelchoicefield-queryset/
- Official documentation about generic views
No comments:
Post a Comment