21👍
Aren’t you supposed to import like:
from mysite.myapp.models import Organization
admin.site.register(Organization)
12👍
For me it was very silly reason.
I have enabled permissions. Admin user didn’t have the permission to access the models.
I gave the permission to admin user. It worked.
- How can I define a polymorphic relation between models in Django?
- Is there a way to generate pdf containing non-ascii symbols with pisa from django template?
- Django query with distinct and order_by
3👍
For those who are visiting this question, the above answer doesn’t work directly in the current Django version(1.7.7).
The answer to the above question becomes:
from myapp.models import Organization
admin.site.register(Organization)
- How do you make a case for Django [or Ruby on Rails] to non-technical clients
- Convert unicode to datetime proper strptime format
1👍
Another possible reason for not showing app in admin page is Apache doesn’t have permissions. Sometimes we create an app with permission that Apache can’t access it. If Apache doesn’t have access it will not show. For linux users require to change app permissions.
sudo chown -R www-data:www-data app_name
This command will give permisson to Apache to access app folder recursively.
- How does one use a custom widget with a generic UpdateView without having to redefine the entire form?
- Django- getting a list of foreign key objects
- Using a Django variable in a CSS file
- Getting the request origin in a Django request
1👍
in your admin.py
file inside your main( first and default )
app of your project
do this
in my case i have 3 app as follow
cityapp,stateapp,countryapp
so in my admin.py file i will add following line
from django.contrib import admin
from stateapp.models import State
from countryapp.models import Country
from cityapp.models import City
admin.site.register(Country)
admin.site.register(State)
admin.site.register(City)
it works in my case see
- Django – 'WhereNode' object has no attribute 'output_field' error
- Django rest framework: how to turn off/on pagination in ModelViewSet
- Django: set_password isn't hashing passwords?
- Load static files for all templates in django