Sunday, August 21, 2011

Re: Specific models without a database table

> That is substantially harder, but could be possible. The main problem is that the Django ORM will want to write SQL queries when there's a link to the EmailAccount model.
>
> Your best bet is probably a proxy model that contains a reference to the relevant API record (e.g. the email address identifier or whatever the API uses), and then a custom save() method that writes the values out to the DB. You can use the Django form logic etc without it needing to be backed by a model.
>
> It will largely depend on how you want the EmailAccount to look - the closer you want it to work to a standard ORM model, the more work you'll have to do to trick things. If it's a simple field that isn't used for queries, then you could look at creating a custom field type that knows how to read/write the values to the API.

Are there any examples out there that get me started for overriding the save() method?

Ideally, I'd like to create fields in the Model that will similarly match fields in the mail server's API, so I can do queries, updates, etc. I realize that I will need to do a lot of trickery to try to bring it closer to the standard ORM model. So any little examples that might be out there would be helpful.

> All the above advice is worth exactly what you paid for it!

Thanks again!

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate