Thank you, I had various as errors as you pointed out and as soon as I
implemented your suggestions and reset the database it all works now.
On Apr 20, 8:43 am, Peter Rowell <[EMAIL PROTECTED]> wrote:
> > featured_place = models.ForeignKey(Place, null=true, blank=true)
>
> 1. By any chance
> featured_place = models.ForeignKey(Place, null=true, blank=true)
1. By any chance are you getting an error like "NameError: name 'true'
is not defined"? The python keyword is "True", not "true".
2. If you reference a mode before it is defined, you need to supply a
string for the
Oops my featured_place actually reads:
featured_place = models.ForeignKey(Place, null=true, blank=true)
On Apr 19, 9:57 pm, Merrick <[EMAIL PROTECTED]> wrote:
> I updated the City model:
>
> class City(models.Model):
> state = models.ForeignKey(State)
> featured_place =
I updated the City model:
class City(models.Model):
state = models.ForeignKey(State)
featured_place = models.ForeignKey(Place, related_name=places)
city = models.CharField(max_length=100, unique=True)
but now I get another error when running syncdb:
NameError: name 'Place' is not
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
> 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
I am using the admin to do all of my data input.
I have the following models:
class City(models.Model):
city = models.CharField(max_length=100, unique=True)
class Place(models.Model):
city = models.ForeignKey(City)
title = models.CharField(max_length=255)
is_featured =
7 matches
Mail list logo