1

こんにちはみんな私はdjangoデータベースにテーブルを作成しようとしています。つまり、syncdbをしようとしていますが、ここに私が遭遇したエラーがあります

-bash-3.2$ ~/html/ENV/bin/python2.7 manage.py syncdb
Creating tables ...
Creating table red_carpet_contactus
ValueError: The database backend does not accept 0 as a value for AutoField.

ここにモデルファイルがあります

from django.db import models
#from django.contrib.auth.models import User

class Page (models.Model):
    Info= models.TextField()
    page_name=models.CharField(max_length=100)
    def __unicode__(self):
        return u"%s" % self.page_name

class category(models.Model):
    category_name = models.CharField(max_length=255)
    def __unicode__(self):
        return u"%s" %(self.category_name)


class contactus(models.Model):
    PageName = models.CharField(max_length=255)
    Phone = models.CharField(max_length=255)
    Mob = models.CharField(max_length=255)
    Address = models.CharField(max_length=255)
    Fax = models.CharField(max_length=255)
    Email = models.CharField(max_length=255)
    def __unicode__(self):
        return u"%s" %(self.page_name)

class gallery(models.Model):
    title = models.CharField(max_length=200, blank=True, null=True)
    Description = models.CharField(max_length=200, blank=True, null=True)
    picture = models.FileField(upload_to='photos/')
    thumbnail = models.FileField(upload_to='thumbnail/', blank=True, null=True)


    def __unicode__(self):
        return u"%s" % self.picture.url


class images(models.Model):
    image = models.FileField(upload_to='images/')

#addition of the main page logo
class Main_page_img(models.Model):
    logo = models.FileField(upload_to='images/')

    def __unicode__(self):
        return u"%s" % self.logo.url

class fields_class(models.Model):
    data = models.TextField()
    content = models.CharField(max_length=150)
    def __unicode__(self):
        return u"%s" % self.content


class trips_main_data(models.Model):
    image = models.ManyToManyField(gallery)
    short_description = models.CharField(max_length=255)
    trip_name = models.CharField(max_length=255)
    country_info = models.TextField(blank=True, null=True)
    trip_info = models.TextField()
    fields = models.ManyToManyField(fields_class,blank=True, null=True)
    category = models.ForeignKey(category)

    def __unicode__(self):
        return u"%s" % self.trip_name

それで、この問題を解決する方法を教えてくれませんか??

4

0 に答える 0