|
Re: i need custom database behaviour, but i dont know how to do it: msg#02274DjangoUsers
hmm i have to explain more i think lets think that i have a category tree like that All '--- Animals ' '---Dogs ' '---Cats ' '---Fishes ' '--- Computers '--- Laptops '--- Desktops '--- Accessories and that category items has path property like : All = "all" Animals = "all/animals" Dogs = "all/animals/dogs" Cats = "all/animals/cats" Fishes = "all/animals/fishes" Now, that is important part, lets think that i am selected Animals category, than announces that is in Dogs, Cats and Fishes category must be shown.. İ tried doing it with loops before but at the result i see that i am making too much database queries than i found a method... later, i found that, if i wrote category path on announces, and write a custom manager, i can make a query like Announce.objects.GetByCategory("/all/animals") that makes a querty on database select * from announces where category startswith 'all/animals' (i dont know sql well ill research later) than it will result all announces whichs category is Dogs or Cats or Fishes or Announce.objects.GetByCategory("/all/") will return all announces that is categorized with Animals or Computers or Laptops or Cats My english is very bad, i wish i explained well my stiuation. After that problem solved i think i can publish my category applicaton. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
|
|
||||||||||||||||||||||||||
|
|
|
| News | Mail Home | sitemap | FAQ | advertise |