On 3/5/06, Ian Holsman <[EMAIL PROTECTED]> wrote:
> One of the things I have in my model is the 'site' which is a foreign
> key to the Site model.
>
> now I'd like this field to be invisible to the rest of the
> application. I've got the retrieval function going via the manager
> model.. which works great, but now I'm having some issues creating new
> objects.
>
> my basic problem seems to be that I need to break the model/features
> to get it done.
>
> 1. I need to set the foreign key to allow for blanks to get the
> validator to go through
> 2. I need to set the 'site_id' magic field explicitly
> 3. to get the 'id' I think it is doing a db-call (not 100% on this)
>
> is there a better way? I really don't want to do this in middleware or
> in the views as it seems like this kind of change should be localized
> in the model area (or am I just being anal)

Number 1 on your list will be solved by validation-aware models -- you
can use a custom Field subclass and override its validate_all() method
for full control over validation. I believe #2 is solved as well, and
I don't follow the question for #3...

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to