Re: Django doesn't validates CharFields before gitting the DB?
> > What database backend are you using?. postgresql_psycopg2 On Apr 17, 12:51 pm, Horacio de Oro <hgde...@gmail.com> wrote: > > What database backend are you using?. > > PostgreSQL 8.3 > > > Can you see what's the actual DLL definition of the image_content_type > > field? (i.e. does it contain 'NULL' or 'NON NULL'). > > The DLL is OK: > > CREATE TABLE "myprojects_simplemodelc" ( > "id" serial NOT NULL PRIMARY KEY, > "name" varchar(256) NOT NULL, > "image_content_type" varchar(32) NOT NULL > ); > > > Has the table been generated by Django itself from the model or is > > it a legacy database that you've generated the models from by > > introspecting it?. > > All the tables where generated using syncdb. > > Horacio --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django doesn't validates CharFields before gitting the DB?
> > What database backend are you using?. > PostgreSQL 8.3 > Can you see what's the actual DLL definition of the image_content_type > field? (i.e. does it contain 'NULL' or 'NON NULL'). > The DLL is OK: CREATE TABLE "myprojects_simplemodelc" ( "id" serial NOT NULL PRIMARY KEY, "name" varchar(256) NOT NULL, "image_content_type" varchar(32) NOT NULL ); > Has the table been generated by Django itself from the model or is > it a legacy database that you've generated the models from by > introspecting it?. > All the tables where generated using syncdb. Horacio --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django doesn't validates CharFields before gitting the DB?
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 django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---