Why not something like this:
class Person(models.Model):
@classmethod
def male(cls):
return cls.objects.filter(gender='M')
@classmethod
def female(cls):
return cls.objects.filter(gender='F')
name = models.CharField(maxlength=20)
gender = models.CharField(m
hello guys,
I wanted to display validation errors in the form .I tried this
class BookForm(ModelForm):
class Meta:
model=Book
def clean_bookname(self):
bkname=self.cleaned_data['bookname']
bkname=bkname.strip()
if Book.objects.filter(bookname__iexact=bkname)
Yeah, no problem. This is a snippet I've used before. If there aren't
errors it just wraps a div around the label and input element. If
there are errors it appends a class of 'error' to the div.
{% for field in form %}
{% if field.errors %}
{% else %}
{% endif %}
{% if field.fiel
Just started using haystack. I've created an extended search form of
SearchForm and have it located at /mysite/search/search_forms.py
The import error happens in haystack.urls
Traceback:
File "/home/adam/stldata-djangosvn-2.6/lib/python2.6/site-packages/
django/core/handlers/base.py" in get_resp
101 - 104 of 104 matches
Mail list logo