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

  • Home
  • SEARCH
  • 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 8068073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:32:18+00:00 2026-06-05T12:32:18+00:00

I’m experiencing this error in Django 1.2 admin. Scenario: I have two applications, say

  • 0

I’m experiencing this error in Django 1.2 admin.

Scenario:

I have two applications, say app1 and app2 inside my project.
In both of these apps, I defined their respective admin.py files to hook each apps respective models to django’s admin site.

Inside app1 admin.py, I defined three ModelAdmin classes corresponding to three models class in app1 and registered two of them to the admin site.

class App11stModelAdmin (admin.ModelAdmin):
    #class definitions here

    #This class is an abstract class
    #class Meta:
    #   abstract = True

class App12ndModelAdmin (admin.ModelAdmin):
    #class definitions here

class App13rdModelAdmin (admin.ModelAdmin):
    #class definitions here

#register to admin site two of them
admin.site.register(App12ndModel, App12ndModelAdmin)
admin.site.register(App13rdModel, App13rdModelAdmin)

Inside app2, I imported app1.App11stModelAdmin to define the admin model of an app2 model.

inside admin.py of app2:

from app1.admin import App11stModelAdmin

class App21stModelAdmin(App11stModelAdmin):
    #define some things here

#register App21stModelAdmin to admin site
admin.site.register(App21stModel, App21stModelAdmin)

With this code, I am getting this error message:

AlreadyRegistered at /admin/

The model App12ndModel is already registered

Request Method:     GET
Request URL:    http://127.0.0.1:8000/admin/
Django Version:     1.2
Exception Type:     AlreadyRegistered
Exception Value:    

The model App12ndModel is already registered

This strange because I’m sure I’m only registering that model’s admin once. When I commented out the register statement for that model, I got the same error, but now for App13rdModel model.

In the meantime, to fix this issue, I removed the registration statements and instead put them inside a ‘static’ function inside app1 admin.py.

like:
inside app1 admin.py

def register():
    admin.site.register(App12ndModel, App12ndModelAdmin)
    admin.site.register(App13rdModel, App13rdModelAdmin)

and then in app2 admin.py

I included the register function in the import:

from app1.model import App11stModelAdmin, register

 ......
 ......
#register the two admin model in app1 inside app2 admin.py by calling the register function
register()

And this works. I am not getting the Already Registered error anymore.

Question:

What did I do which resulted to that error? I am new to Django and Python.

Thank you very much!

  • 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-05T12:32:19+00:00Added an answer on June 5, 2026 at 12:32 pm

    admin.py files are executed by Django during runtime so if you import an admin.py script into another script, you are actually executing the exposed admin.site.register functions again, which thus gives you the Already Registered error.

    This is in fact standard Python behavior. Consider the following script (save as sample.py):

    def multiplier(x,y):
        return x*y
    
    def sample_write(text):
        out = open("out.txt","w")
        out.write(text)
        out.close()
    
    sample_write("hey") # Notice this executed function
    

    When you open your Python interpreter in the same directory and do import sample it will write the out.txt output. The same case when you selectively import the multiplier function like from sample import multiplier, the output file is still written. The only way to avoid the output file being written is to comment out the executed function in the script or wrap it into another function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text

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.