I'm using Django Beta 2

This is my post data

body    u'body'
status  u'2'
allow_comments  u'on'
_save              u'Save'
lead            u'lead'
author          u'1'
title                   u'Test Post'
site                    u'2'
publish_1       u'15:04:22'
publish_0       u'2008-09-03'
lead_image      u''
slug                    u'test'

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')

On Sep 3, 3:31 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> > Seems like I'm headed in the right direction, I made the changes you
> > suggested but now I'm getting a warning.
> > <snip>
>
> > Exception Type: Warning at /admin/posts/article/add/
> > Exception Value: Incorrect integer value:
> > '<django.db.models.fields.related.ManyRelatedManager object at
> > 0xfd8d50>' for column 'site_id' at row 1
>
> > Not sure what's going on...
>
> I don't know how your Article and other such models are defined, by
> are you guaranteed to have a valid Site instance for instance.site or
> can that value be None? If you're in DEBUG mode (settings.DEBUG=True),
> you should be able to see the value of 'site' in your browser. If not,
> try printing 'site' and 'site.pk' just before you make the site.add()
> call.
>
> Also, what version of Django are you on?
>
> -Rajesh D
--~--~---------~--~----~------------~-------~--~----~
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