Re: USStateField default value

2012-01-02 Thread Martin Pajuste
You get that error because 'blank' is model field option. If you want to be able to accept empty values, use required=False instead. > state = USStateField(initial='CA', required=False) -- You received this message because you are subscribed to the Google Groups "Django users" group. To view

Re: Get the current url in django template

2011-11-10 Thread Martin Pajuste
If you need something like "http://example.com/music/bands/the_beatles/?print=true; try {{request.build_absolute_uri}} https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.build_absolute_uri -- You received this message because you are subscribed to the Google

Vs: how to override a ModelChoiceField in order to add FKs directly in a TextInput?

2011-06-29 Thread Martin Pajuste
Since ModelChoiceField validates that the given id exists in the queryset, there can be no valid choices when you use MyRelatedClass.objects.none(). Try MyRelatedClass.objects.all() or filter by some attribute. If the queryset depends on some user input or conditions you can use something

Re: Customizing error message in ModelForm

2011-04-15 Thread Martin Pajuste
This should do the trick: class PrijsvraagForm(ModelForm): mail = forms.EmailField(error_messages={'required':'Vul aub een geldig Email adres in', 'invalid': 'Het email adres is niet geldig'}) class Meta: model = Prijsvraag def clean_code(self):

Re: Customizing error message in ModelForm

2011-04-15 Thread Martin Pajuste
Error messages in ModelForms work perfectly fine. class PersonForm(forms.ModelForm): first_name = forms.CharField(error_messages={'required': 'Please enter your first name!'}) class Meta: model = Person http://docs.djangoproject.com/en/dev/ref/forms/fields/#error-messages --

Re: Stackoverflow kind of Answer/commenting app in Django

2011-04-13 Thread Martin Pajuste
Are You aware of Django’s comments framework? http://docs.djangoproject.com/en/dev/ref/contrib/comments/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from

Re: How to check if request.FILES is empty

2011-04-08 Thread Martin Pajuste
You'll find well written documentation how to treat basic file uploads in Django documentation http://docs.djangoproject.com/en/dev/topics/http/file-uploads/#basic-file-uploads -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Django News Site Resources

2011-04-08 Thread Martin Pajuste
http://djangopackages.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more

Re: How to check if request.FILES is empty

2011-04-08 Thread Martin Pajuste
What you are looking for is probably something like if 'uploadphoto' in request.FILES: -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send

Re: "CSRF verification failed" when sending simple GET request using curl

2011-01-19 Thread Martin Pajuste
curl -d "name=Bob" -G http://localhost:8000/demo/test -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to

Re: "CSRF verification failed" when sending simple GET request using curl

2011-01-19 Thread Martin Pajuste
-d flag sends the specified data in a POST request to the HTTP server, since you don't supply CSRF token, Django assumes the post is malicious. See more http://docs.djangoproject.com/en/dev/ref/contrib/csrf/?from=olddocs -- You received this message because you are subscribed to the Google

Re: len(qs.all()) != qs.count()

2011-01-19 Thread Martin Pajuste
I would say the problem is in your model. Notice in the beginning of the SQL there is "productdescriptions"."id" yet there is no such field in database. Just specify primary_key=Trueon one of your