Reputation: 41
In my django admin panel there are four items: "Groups", "Users", "Sites", and my custom model "Ads". All of it has button "Add" and "Change". System items' button works as usual. And my model's button "Add" redirect on blank page with title "add (1x1)", button "Change" redirect on blank page with title "ad (1x1)".
It happens even when I create project from Django tutorial https://docs.djangoproject.com/en/1.4/intro/tutorial01/
I use django's development server.
from django.db import models
class Ad(models.Model):
text = models.TextField()
tel = models.CharField(max_length=12)
pub_date = models.DateTimeField(auto_now_add=True)
checked = models.BooleanField(default=False)
def __unicode__(self):
return self.text[0:20]
from models import Ad
from django.contrib import admin
admin.site.register(Ad)
Very simple code.
How to get normal Add and Change pages?
UPD: System - Windows, browsers - Chrome, Firefox, Opera
Upvotes: 4
Views: 7134
Reputation: 1495
also, in your admin.py file, if you have something like:
admin.site.get_urls = {{admin_urls}}
this should be after registering your (admin) model otherwise you seem to loose edit/add/delete links on admin (django 1.6)
Upvotes: 0
Reputation: 11108
I was seeing all the models in the admin but none of them were editable. I had no available actions. My urls.py
looked normal to me:
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
)
admin.autodiscover()
I moved admin.autodiscover()
to the top of the file, before the urlpatterns
declaration, and everything started working normally:
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
)
Upvotes: 8