Thank you, I originally had featured_place as a foreign key and ran
into a problem:

null value in column "featured_id" violates not-null constraint

That is because before there is a place there has to be a city.

On Apr 19, 9:37 pm, Doug B <[EMAIL PROTECTED]> wrote:
> > What is the best practice for making it so when I toggle is_featured
> > to on for Balboa Park the admin enforces a rule that only one place
> > can be featured for a city. Hope that makes sense, thank you.
>
> You could override save on Place and unset the other places.  Although
> I think it might be better to change your models slightly:
>
> class City(models.Model):
>      city = models.CharField(max_length=100, unique=True)
>      featured_place=models.ForeignKey('Place')
>
> class Place(models.Model):
>     city = models.ForeignKey(City)
>     title = models.CharField(max_length=255)
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to