I've been doing a couple of django tutorials over and over again just learn
by rote, so to speak. They are the 'Writing your first Django App' and
'djangoles-tutorial.pdf. Today I decided to just try and build a similar
project from scratch and I've run into a couple of problems. When I tried to
add list_display django is giving me the error: type object 'BudType' has no
attribute 'fields'
The code is very similar to the tutorial so I don't know why this is
happening...? Aren't CharField and IntegerField the fields?
any help is appreciated. Below is the models and admin.
thanks,
Aaron
from django.db import models
import datetime
class BudType(models.Model):
kind_of_bill = models.CharField(max_length = 255)
bill_importance = models.IntegerField()
def __unicode__(self):
return self.kind_of_bill
class Bill(models.Model):
bill_amount = models.IntegerField()
date_due = models.DateTimeField('date due')
title = models.CharField(max_length=255)
desc = models.CharField(max_length=255)
bill_type = models.ForeignKey(BudType)
def __unicode__(self):
return self.title
def due_today(self):
return self.date_due.date() == datetime.date.today()
and then the admin:
from models import Bill, BudType
from django.contrib import admin
class BillAdmin(admin.ModelAdmin):
list_display = ('title', 'date_due')
admin.site.register(Bill, BudType)
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
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.