Re: newbie. need help in validation

2009-10-14 Thread Daniel Roseman

On Oct 14, 10:42 am, Kenneth Gonsalves  wrote:
> On Wednesday 14 Oct 2009 3:08:00 pm robin nanola wrote:
>
> > try reading this
> >http://www.cotellese.net/2007/12/11/adding-model-field-validation-to-...
> >ango-admin-page/
>
> I do not think validators exist in django now - that blog post was done in
> 2007.

That's correct, the code in that post will not work.

The way to do it now is to define a custom form and do the validation
there, then set the modeladmin class for your model to use that custom
form.
--
DR.
--~--~-~--~~~---~--~~
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: newbie. need help in validation

2009-10-14 Thread Brett Parker

On 14 Oct 02:34, danin wrote:
> 
> hi guys,
> I am new to Django (started 2 weeks back). right now i am
> designing one application having model-
>  class info(models.Model):
>name=models.CharField(max_length=100)
>dob=models.DateField()
>dod=models.DateField()
>address=models.CharField(max_length=250)
>pin=IntegerField(msx_length=10)
> 
> I am entering data in database via admin CRUD. but while entering the
> data i want to perform some validations like :
>   1. No negative number in pin field.
>   2. dob 
> can anyone please guide me in this. i am not able to fiure out where
> to performed this validation and how.

I think the document you're looking for is:

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin

If you read all of that page, then I'm sure the custom validation will
make sense.

Thanks,
-- 
Brett Parker

--~--~-~--~~~---~--~~
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: newbie. need help in validation

2009-10-14 Thread Kenneth Gonsalves

On Wednesday 14 Oct 2009 3:08:00 pm robin nanola wrote:
> try reading this
> http://www.cotellese.net/2007/12/11/adding-model-field-validation-to-the-dj
>ango-admin-page/

I do not think validators exist in django now - that blog post was done in 
2007.
-- 
regards
kg
http://lawgon.livejournal.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 options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newbie. need help in validation

2009-10-14 Thread Kenneth Gonsalves

On Wednesday 14 Oct 2009 3:04:10 pm danin wrote:
> I am new to Django (started 2 weeks back). right now i am
> designing one application having model-
>  class info(models.Model):
>name=models.CharField(max_length=100)
>dob=models.DateField()
>dod=models.DateField()
>address=models.CharField(max_length=250)
>pin=IntegerField(msx_length=10)
>
> I am entering data in database via admin CRUD. but while entering the
> data i want to perform some validations like :
>   1. No negative number in pin field.
>   2. dob
> can anyone please guide me in this. i am not able to fiure out where
> to performed this validation and how.

One way would be to override your save() method - do the validation and then 
save, if it does not pass the validation raise an error.
-- 
regards
kg
http://lawgon.livejournal.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 options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newbie. need help in validation

2009-10-14 Thread robin nanola
try reading this
http://www.cotellese.net/2007/12/11/adding-model-field-validation-to-the-django-admin-page/

On Wed, Oct 14, 2009 at 5:34 PM, danin  wrote:

>
> hi guys,
>I am new to Django (started 2 weeks back). right now i am
> designing one application having model-
>  class info(models.Model):
>   name=models.CharField(max_length=100)
>   dob=models.DateField()
>   dod=models.DateField()
>   address=models.CharField(max_length=250)
>   pin=IntegerField(msx_length=10)
>
> I am entering data in database via admin CRUD. but while entering the
> data i want to perform some validations like :
>  1. No negative number in pin field.
>  2. dob
> can anyone please guide me in this. i am not able to fiure out where
> to performed this validation and how.
>
>
> Thanks.
> Danin
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



newbie. need help in validation

2009-10-14 Thread danin

hi guys,
I am new to Django (started 2 weeks back). right now i am
designing one application having model-
 class info(models.Model):
   name=models.CharField(max_length=100)
   dob=models.DateField()
   dod=models.DateField()
   address=models.CharField(max_length=250)
   pin=IntegerField(msx_length=10)

I am entering data in database via admin CRUD. but while entering the
data i want to perform some validations like :
  1. No negative number in pin field.
  2. dobhttp://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---