Monday, September 7, 2015

Re: Missing/inconsistent GenericIPAddressField validation?

On Mon, Sep 7, 2015 at 12:33 PM, Hans S. Tømmerholt <hanst@opera.com> wrote:
> GenericIPAddressField isn't intended to represent a CIDR address, which I
> guess is what I'm trying to put into it.
>
> There is stuff like this:
> https://pypi.python.org/pypi/django-netfields/0.2.1

+1

This is what we use for CIDR and arbitrary IP ranges, stored in
postrgres as native types so that queries/filters all happen on the DB
server with exceptional performance.

>
> I am still slightly confused as to why validation doesn't occur on the model
> level, though.


Validation only happens if you instruct it to happen. If you just
save() the model instance, no validation occurs. See the "Note ..."
paragraph here:

https://docs.djangoproject.com/en/1.8/ref/models/instances/#validating-objects

Cheers

Tom

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFHbX1%2BmgjY2%3DeX2Z53eFr7LBKwDeJRpR%3DQqRWUCLUmFsOoPaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment