Hi! I've a problem with Django not validating my 'CharField's. Maybe
I'm misunderstanding the docs, and Django doesn't do this kind of
validations?
I've made a simple example. This is the model:
class SimpleModelC(models.Model):
name=models.CharField(max_length=256)
image_content_type=models.CharField(max_length=32, null=False,
blank=False)
and a simple view that get a parameter from request.GET:
def view_c3(request):
model_c=SimpleModelC()
model_c.name=request.GET['name']
model_c.save()
return HttpResponseRedirect("/ok/from/c3/")
Doing a request to: http://localhost:8000/view_c3/?name=Peter
I get a redirect to '/ok/from/c3/', and in the database:
SELECT * from myprojects_simplemodelc;
id | name | image_content_type
----+-------+--------------------
7 | Peter |
(1 row)
Since 'SimpleModelC.image_content_type' is required to be not-null and
not-empty, shouldn't Django check for this before doing the INSERT?
In the database, in 'image_content_type'I get a blank string.
This is happening me with Django 1.0.2 and the development version of
Django 1.1.
Thanks in advance!
Horacio
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---