logo       

Re: i need custom database behaviour, but i dont know how to do it: msg#02271

DjangoUsers

Subject: Re: i need custom database behaviour, but i dont know how to do it


On Jul 31, 11:25 am, Mirat Bayrak <miratcanbay...@xxxxxxxxx> wrote:
> I am working on a *Categories* application for my project. The model that i
> need to categorize ise *Announces*.. i descibed category in announces like
> this
>
> class Category
>     ...
>     ...
>     path = models.CharField ....
>
> class Announce:
>     ...
>     ...
>     ...
>     category = models.ForeignKey(Category)
>
> So my question,
>
> This* Announce model saves id of category* on database and calls with id
> when it needed, but *i want to make it save Category.path *
>
> can i do it easly? or should i override something ? any ideas?

Do you mean you want the foreign key value to be the 'path' field of
the Category model? You could do this, but why would you want to? If
you ever want to refer to the category path from an Announce instance,
you just do:
announce.category.path

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

Google Custom Search

News | Mail Home | sitemap | FAQ | advertise