Re: Positive integer form field with max lenght

2009-04-09 Thread emonk
duh, iam a fool

Thanks to both for the fast response :)

On Thu, Apr 9, 2009 at 4:46 AM, Adi Sieker  wrote:

>
>
> On 09.04.2009, at 09:27, emonk wrote:
>
> > Hi people.
> > This is my doubt
> >
> > I need make a form field with this restrictions:
> >
> > _field content must be only integers numbers and postive.
> > _filed content must have a max lenght, for example 8 characters.
> >
> > I am confused beacuse models.PositiveIntegerField has no have
> > max_length atribute (have a max_value), but models.CharacterField
> > have max_lenght atribute.
> >
> > Any idea? :S
>
> An integer doesn't usually have a max length, if at all it has a max
> value. Which in your case sounds like 99.999.999.
> To actually achieve what you want read through the form validation
> docs http://docs.djangoproject.com/en/dev/ref/forms/validation/
>
> adi
>
> >
>


-- 
---
Key fingerprint = 0CCB D0F6 47F2 5F70 6F40  53D3 7537 A0E4 94FC 40EE
--

--~--~-~--~~~---~--~~
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: Positive integer form field with max lenght

2009-04-09 Thread Adi Sieker


On 09.04.2009, at 09:27, emonk wrote:

> Hi people.
> This is my doubt
>
> I need make a form field with this restrictions:
>
> _field content must be only integers numbers and postive.
> _filed content must have a max lenght, for example 8 characters.
>
> I am confused beacuse models.PositiveIntegerField has no have  
> max_length atribute (have a max_value), but models.CharacterField  
> have max_lenght atribute.
>
> Any idea? :S

An integer doesn't usually have a max length, if at all it has a max  
value. Which in your case sounds like 99.999.999.
To actually achieve what you want read through the form validation  
docs http://docs.djangoproject.com/en/dev/ref/forms/validation/

adi

--~--~-~--~~~---~--~~
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: Positive integer form field with max lenght

2009-04-09 Thread Malcolm Tredinnick

On Thu, 2009-04-09 at 04:27 -0300, emonk wrote:
> Hi people.
> This is my doubt
> 
> I need make a form field with this restrictions:
> 
> _field content must be only integers numbers and postive.
> _filed content must have a max lenght, for example 8 characters.
> 
> I am confused beacuse models.PositiveIntegerField has no have
> max_length atribute (have a max_value), but models.CharacterField have
> max_lenght atribute. 

Firstly, if you're talking about forms, you don't want to look at
models.PostiveIntegerField -- that's for models. Instead, look at
django.forms.*

Secondly, the equivalent concept to string length is max_value and
min_value for the form field IntegerField. It sounds like you want

IntegerField(min_value=0, max_value=)

See http://docs.djangoproject.com/en/dev/ref/forms/fields/#integerfield
for the documentation.

Regards,
Malcolm



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



Positive integer form field with max lenght

2009-04-09 Thread emonk
Hi people.
This is my doubt

I need make a form field with this restrictions:

_field content must be only integers numbers and postive.
_filed content must have a max lenght, for example 8 characters.

I am confused beacuse models.PositiveIntegerField has no have max_length
atribute (have a max_value), but models.CharacterField have max_lenght
atribute.

Any idea? :S

Thanks a lot.


-- 
---
Key fingerprint = 0CCB D0F6 47F2 5F70 6F40  53D3 7537 A0E4 94FC 40EE
--

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