django-admin

How to register inherited sub class in admin.py file in django?

北战南征 提交于 2021-01-29 07:21:06
问题 Project Name : fusion App Name : admin_lte Python 3.7 Django 2 MySql Question is "I want to register sub model in django admin-panel",when i write code for model registration in admin.py file that time occurred below error. django.core.exceptions.ImproperlyConfigured: The model Device is abstract, so it cannot be registered with admin. NOTE : I used multiple separated model file. device.py (Model File) from django.db import models class Device(models.Model): device_type = models.CharField(max

Can't login to django admin account after creating super user

眉间皱痕 提交于 2021-01-29 06:06:13
问题 I created a project in django and the first thing I want to do is to create a superuser for admin account and then proceed with the django project but the problem is after creating a superuser account using python manage.py createsuperuser and filling out the information the superuser gets created it says Superuser created successfully. But when I try to login with these credentials it says Please enter the correct username and password for a staff account. Note that both fields may be case

Django admin logging out on model save

微笑、不失礼 提交于 2021-01-29 04:27:06
问题 I'm running a Django app for my root public_html folder, and it's working fine. But there's a problem with one of my other apps. The problematic app is accessed through a redirect to a subdirectory (e.g. http://workingsite.com redirects to public_html, http://brokensite.com redirects to public_html/foo) The problem is that the session expires whenever anything needs to be saved in the Django admin (either added or changed). If you try again, sometimes it works. This does not happen on my own

LookupError: App 'Hierarchy' doesn't have a 'CustomUser' model

青春壹個敷衍的年華 提交于 2021-01-28 10:15:43
问题 I've been following the Django documentation to create a custom user model. Here is the main error - (Edit - I was asked to add the entire traceback so here it is) Watching for file changes with StatReloader Exception in thread django-main-thread: Traceback (most recent call last): File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python37\lib\site-packages\django\apps\config.py", line 178, in get_model return self.models[model_name.lower()] KeyError: 'customuser' During handling of the

LookupError: App 'Hierarchy' doesn't have a 'CustomUser' model

家住魔仙堡 提交于 2021-01-28 10:11:00
问题 I've been following the Django documentation to create a custom user model. Here is the main error - (Edit - I was asked to add the entire traceback so here it is) Watching for file changes with StatReloader Exception in thread django-main-thread: Traceback (most recent call last): File "C:\Users\Lenovo\AppData\Local\Programs\Python\Python37\lib\site-packages\django\apps\config.py", line 178, in get_model return self.models[model_name.lower()] KeyError: 'customuser' During handling of the

Django-admin won't allow me to modify user permissions and groups

孤街醉人 提交于 2021-01-28 05:22:52
问题 When editing user model through admin interface, here's what I see: And here's what I expect to see: The second one allows me to modify the user permissions, the first one does not. The User model I use on the first screenshot inherits from AbstractUser and is registered in the following way: from django.contrib import admin import accounts.models admin.site.register(accounts.models.User) In my settings: DEBUG = True AUTH_USER_MODEL = 'accounts.User' What can be the problem? How do I get from

Importing django.contrib.auth.urls does not play well with existing admin templates

我是研究僧i 提交于 2021-01-28 01:07:45
问题 I've been trying to follow documentation on using builtin Django templates to login/logout nonstaff users on a Django (1.9) site. In particular, I modified the urlconf by adding url('^', include('django.contrib.auth.urls')) which brings in /login and /logout endpoints and views with default template names preprogrammed. The default template names for login and logout are registration/login.html and registration/logged_out.html . The first one doesn't exist anywhere, so I assumed I should

Multiselect dropdown/list in django admin panel only

两盒软妹~` 提交于 2021-01-27 12:45:05
问题 django model choice option as a multi select box Django Multiple Choice Field / Checkbox Select Multiple Django: How can i create a multiple select form? I'm trying to add a multiselect field in existing django model. I went through these three SOF threads and some other blogs but I didn't find required solution. everyone is using modelForms. I want this in purely in default django admin panel (same as choice field). this field is not going to be used in front-end/any kind of form. purely for

Multiselect dropdown/list in django admin panel only

Deadly 提交于 2021-01-27 12:41:26
问题 django model choice option as a multi select box Django Multiple Choice Field / Checkbox Select Multiple Django: How can i create a multiple select form? I'm trying to add a multiselect field in existing django model. I went through these three SOF threads and some other blogs but I didn't find required solution. everyone is using modelForms. I want this in purely in default django admin panel (same as choice field). this field is not going to be used in front-end/any kind of form. purely for

changing admin site url

孤人 提交于 2021-01-27 08:01:19
问题 Is there a way to change the url to open the admin site in django? I don't want to use the default /admin url. I am new to django so please try giving a bit more detailed information. 回答1: In urls.py, change the line that reads: (r'^admin/(.*)', admin.site.root), to something like: (r'^new_admin/(.*)', admin.site.root), so now instead of http://example.com/admin you'd use http://example.com/new_admin 回答2: Sure, the file urls.py in the root of your project maps URLs to handlers. Just change