On Sep 3, 3:59 pm, nek4life <[EMAIL PROTECTED]> wrote:
> I'm using Django Beta 2

If, instead of top-posting, you bottom-post your responses, it's
easier for people to see which questions you're responding to.

<snip>
>
> Here is my article model
>
> from django.db import models
> from django.contrib.sites.models import Site
> from django.contrib.sites.managers import CurrentSiteManager
> from django.contrib import admin
> from django.contrib.auth.models import User
>
> class Article(models.Model):
>     """Article Model"""
>     STATUS_CHOICES = (
>         (1, 'Draft'),
>         (2, 'Public'),
>     )
>     title          = models.CharField(max_length=200)
>     slug           = models.SlugField()
>     author         = models.ForeignKey(User, blank=True, null=True)
>     lead           = models.TextField()
>     lead_image     = models.FileField(upload_to="lead_images",
> blank=True)
>     body           = models.TextField()
>     site           = models.ManyToManyField(Site)
>     on_site        = CurrentSiteManager()
>     status         = models.IntegerField(choices=STATUS_CHOICES,
> default=1)
>     allow_comments = models.BooleanField(default=True)
>     publish        = models.DateTimeField()
>     created        = models.DateTimeField(auto_now_add=True)
>     modified       = models.DateTimeField(auto_now=True)
>
>     def __unicode__(self):
>         return '%s' % self.title
>
>     class Meta:
>         verbose_name        = ('article')
>         verbose_name_plural = ('articles')


Ah, I previously assumed that Article.site is a ForeignKey. See if you
had named it 'sites', it would've been easier to guess?

Anyway, change that previous ti.site.add(site) snippet to:

for s in site:
   ti.site.add(s)

You could also try:
   ti.site = site

But that will wipe out any previous values of site you may have
associated with the same ti instance.

-RD

--~--~---------~--~----~------------~-------~--~----~
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