0
votes

I'm hosting a Django site through mod_wsgi and WAMP with Python 2.7. On my admin site the Users, Groups and Sites sections all have Add and Change buttons. While there is a section each for both of my own custom models, Feedpost and Newspost, they have no buttons at all and there is no way to add or change them. I believe this change came about when I switched from using the Django internal testing server to using WAMP. Does anyone know what's causing this and how to get my Add and Change buttons back?

EDIT:

Here's one of the two models:

from django.db import models
from django.contrib import admin

class FeedPost(models.Model):
    title = models.CharField(max_length=50)
    text = models.CharField(max_length=5000)
    date = models.DateTimeField('Date Published')
    def __unicode__(self):
        return self.title

admin.site.register(FeedPost)

The other is nearly exactly the same.

It turns out that using the Django development server localhost:8000/admin insists on going to my site's homepage and I can't access the admin site at all.

Also I think this is going to turn out to be the problem because I haven't got an admin.py file anywhere in my project...

1
Ok - show us your admin.py and models.py (relevant parts) and also try to use runserver to see if your hypothesis is correct.Jure C.
Could give a slightly clearer account of what you've done to enable the admin account (perhaps having looked at the documentation): include your urls.py and any register(... lines from models.py (if you don't have an admin.py it's possible the registration happens in models instead).supervacuo
I haven't created the ModelAdmin classes, but they are optional and I haven't "Instantiated an AdminSite and told it about each of my models and ModelAdmin classes." because I don't know what that means. The admin site has definitely worked in the past on this site though.user573949
I've found more clearly what the problem is. It's that the Add/Change buttons for my models don't appear when Debug mode is off. If I set Debug = True in the settings.py file I can post fine, but with Debug off the buttons are absent.user573949
That applies for both WAMP and Django internal server.user573949

1 Answers

0
votes

These need to be in the admin.py file for starters.

from django.contrib import admin 
admin.site.register(FeedPost)