Saturday, February 2, 2013

search across models

hi all, i have a big question. 
how can i perform search queries like on following models

RESTAURANT_TYPES = (
    ('C', 'Chinese'),
    ('A', 'American'),
    ('J', 'Japanese'),
)    

class city (models.Model):
    name = models.CharField(max_length=200)

class restaurants(models.Model):
    name = models.CharField(max_length=456)
    city = models.ForeignKey(city)
    type = models.CharField(max_length=10, choices=RESTAURANT_TYPES)
    is_veg = models.BooleanField(default=True)

search queries:
  1. restaurants in city1
  2. city1 restaurants
  3. Chinese restaurants
  4. Chinese restaurants in city1
  5. vegetarian restaurants in city1
  6. vegetarian american restaurants
  7. and so on...

--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment