new Admin interface not quite working

0 views
Skip to first unread message

Chris Curvey

unread,
Oct 30, 2005, 7:49:20 PM10/30/05
to Django users
Trying to write a first app after grabbing revision 1028. I have this
class:

class Customer(meta.Model):
name = meta.CharField(maxlength=50)

class META:
admin = meta.Admin()

When I fire up the admin interface, everything looks good, I can get an
"add customer" form, but when I save a customer, the message is "The
customer "" was added successfully. You may add another customer
below."

When I go to the customer list, all the customer names are blank.
Looking at the source, it looks like:

<table cellspacing="0">
<thead>
<tr>
<th>Customer</th></tr>
</thead>
<tr class="row1">
<th><a href="2/">&nbsp;</a></th></tr>
<tr class="row2">
<th><a href="1/">&nbsp;</a></th></tr>
</table>

The customers have been added to the database, but the names aren't
showing up.

(One more thing -- the project was created with an svn checkout from
before the Admin change, which had then been "svn update"-ed to rev
1208. I had to go in and delete the .pyc files from templatetags to
get the admin interface to work at all. I have since trashed my
working copy and just grabbed a fresh checkout.)

Robert Wittams

unread,
Oct 30, 2005, 8:09:11 PM10/30/05
to django...@googlegroups.com
When you say new admin, you don't mean the new-admin branch, but the
admin move? We need more distinct naming!

I think your problem is that you haven't defined __repr__ for your
customer class.

We might need a better default __repr__ which doesn't contain < and > ,
as a lot of people are getting confused by this...

Chris Curvey

unread,
Oct 30, 2005, 8:20:41 PM10/30/05
to Django users
the admin move from middleware to an application. (Not that I have any
idea what that means just yet :)

Turns out that the __repr__ thing was the fix. I hadn't realized from
the tutorial that you needed __repr__ to make the admin interface work.

Thanks for the quick response! This is fun to work with!

Reply all
Reply to author
Forward
0 new messages