1

I'm using Django 1.11

I want to create an admin specific app which is only accessible by admin interface.

I want to create an app to add country and state records which can be added or edited only by Admin from /admin.

Also, these records can be used by any application to populate a select field in adding a record like address.

If I create country app in mydangoapp/country and add URL to mydangoapp/mydangoapp/urls.py then it can be accessed by other users too by www.example.com/country which I don't want.

Where to create a model for this? Is it possible to create an admin specific app only?

Anuj TBE
  • 9,198
  • 27
  • 136
  • 285

2 Answers2

1

Every app can be used only as admin specific till the time you don't give a urlpatterns for that app to be accessed by users.

So, you just create an app, make models, register them. But don't write views, forms and urls for that app.

Astik Anand
  • 12,757
  • 9
  • 41
  • 51
0

In your case you should do something like that in your mydjangoapp urls.py:-

from country import views as country_views
urlpatterns = [
              url(r'^admin/custom_prefix/country/', include('country.urls')),
              url(r'^admin/', admin.site.urls),
]

Make sure u enter it in this order(i.e. before the r'^admin/' regex) in urlpatterns list. Hope this solves your issues :-)

Amaan Thakur
  • 164
  • 1
  • 4