Thanks Clifford, I'm going to do it that way.  I've got a quick
question though.  Is there any way to skip the admin list page and
redirect it to the edit object page with the first id?  I know I could
do this via javascript, but that's not ideal.

Thanks
Greg

On Dec 1, 6:43 pm, CLIFFORD ILKAY <clifford_il...@dinamis.com> wrote:
> JGAllen23 wrote:
> > I am building a website for a client and one of the pages they need is
> > an "about us" page which would just require 1 row of data.  What is
> > the best way to handle this case where a model would only need 1 data
> > row?
>
> Override the save() method for that model. E.g.
>
> class FeaturedProduct(models.Model):
>     product = models.ForeignKey(Product)
>     description = models.TextField(blank=True, null=True)
>
>     class Admin:
>         pass
>
>     class Meta:
>         verbose_name_plural = 'Featured Product on Home Page'
>
>     def save(self):
>         '''
>         There can only be one featured product and it goes on the home
>         page. Forcing the id to 1 ensures that any attempt to create a
>         new featured product will only modify the existing one.
>         '''
>         self.id = 1
>         super(FeaturedProduct, self).save()
>
>     def __str__(self):
>         return self.product.name+' - '+self.product.product_numberx
> --
> Regards,
>
> Clifford Ilkay
> Dinamis
> 1419-3266 Yonge St.
> Toronto, ON
> Canada  M4N 3P6
>
> <http://dinamis.com>
> +1 416-410-3326
>
>  smime.p7s
> 4KViewDownload
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to