Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8000037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:40:41+00:00 2026-06-04T15:40:41+00:00

I’m a newbie for django. I’m trying to run a sample according to a

  • 0

I’m a newbie for django.

I’m trying to run a sample according to a book about django.

I’ve added “class Admin” to my model classes, however, in the django admin interface, I can only see the “Users”, “Groups” and “Sites”, none of my model classes appear.

There is no error or warning information, so I don’t know what happened and what shall I do next.

Any help?

from django.db import models

# Create your models here.
class Publisher(models.Model):
    name = models.CharField(max_length=30)
    address=models.CharField(max_length=50)
    city=models.CharField(max_length=60)
    state_province=models.CharField(max_length=30)
    country=models.CharField(max_length=50)
    website=models.URLField()

    def __str__(self):
        return self.name

    class Admin:
        pass

class Author(models.Model):
    salutation=models.CharField(max_length=10)
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=40)
    email=models.EmailField()
    headshot=models.ImageField(upload_to='/tmp')

    def __str__(self):
        return '%s %s' % (self.first_name, self.last_name)

    class Admin:
        pass

class Book(models.Model):
    title=models.CharField(max_length=10)
    authors=models.ManyToManyField(Author)
    publisher=models.ForeignKey(Publisher)
    publication_date = models.DateField()

    def __str__(self):
        return self.title
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:40:42+00:00Added an answer on June 4, 2026 at 3:40 pm

    You need to do three things to be able to edit your models via admin site:

    1. Create file ‘admin.py’ in your app directory with code (look https://docs.djangoproject.com/en/dev/ref/contrib/admin/#modeladmin-objects):

      from django.contrib import admin
      from your_app.models import Publisher, Author, Book
      
      admin.site.register(Author)
      admin.site.register(Publisher)
      admin.site.register(Book)
      
    2. In your urls.py add the following (look https://docs.djangoproject.com/en/dev/ref/contrib/admin/#hooking-adminsite-instances-into-your-urlconf):

      from django.conf.urls import patterns, url, include
      from django.contrib import admin
      
      admin.autodiscover()
      
      urlpatterns = patterns('',
          (r'^admin/', include(admin.site.urls)),
          # your urls goes here
      )
      
    3. Be sure, that your settings.py satisfy following (look https://docs.djangoproject.com/en/dev/ref/contrib/admin/#overview):

      TEMPLATE_CONTEXT_PROCESSORS = (
          'django.contrib.messages.context_processors.messages',
          #other context processors
      )
      
      MIDDLEWARE_CLASSES = (
          'django.contrib.messages.middleware.MessageMiddleware',
          # other middleware
      )
      
      INSTALLED_APPS = (
          'django.contrib.admin',
          'django.contrib.auth',
          'django.contrib.contenttypes',
          'django.contrib.messages',
          'django.contrib.sessions',
          # other apps
      )
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.