いくつかのモデルを作成し、django admin に登録しました
admin.site.register({Cat,Comment,User,Bet,Bid})
しかし、Cat と Comment には、データを追加するためのフィールドがありません (画像を参照)。誰かが私が間違っていることを知っていますか?
class User(models.Model):
def __unicode__(self):
return self.user
user = models.CharField(max_length=200,null=True, blank=True)
passwd = models.CharField(max_length=100,null=True, blank=True)
join_date = models.DateTimeField('date joined',null=True, blank=True)
balance = models.DecimalField(max_digits=15, decimal_places=5,max_length=100,null=True, blank=True)
bitaddress = models.CharField(max_length=100,null=True, blank=True)
phone = models.CharField(max_length=100,null=True, blank=True)
email = models.EmailField(max_length=100,null=True, blank=True)
img=models.ImageField(upload_to = 'img/user/')
#this is a bet like "I think that the Lions willwin the Superbowl"
class Bet(models.Model):
def __unicode__(self):
return self.position
position = models.CharField(max_length=255,null=True, blank=True)
date = models.DateTimeField('date published',null=True, blank=True)
cat= models.ForeignKey("Cat",null=True,blank=True)
#lookup field for category - maybe dManyToManyo subcategories
class Cat(models.Model):
def __unicode__(self):
return self.cat_name
cat_name = models.CharField(max_length=255)#,null=True, blank=True)
class Bid(models.Model):
def __unicode__(self):
return self.user
user = models.ForeignKey("User",null=True, blank=True)
amt = models.DecimalField('date published',max_digits=15, decimal_places=5,null=True, blank=True)
bet=models.ForeignKey("Bet",null=True, blank=True)
class Comment(models.Model):
def __unicode__(self):
return self.text
user = models.ForeignKey("User",null=True, blank=True)
bet=models.ForeignKey("Bet",null=True, blank=True)
text=models.TextField()#null=True,blank=True)
#parent=models.ForeignKey-->another comment