Use of xadmin in python 3.5 and fix the source code bug, pythonxadmin
Preface
Xadmin is a django management backend implementation. It uses a more flexible architecture design and Bootstrap UI framework to replace the existing admin, developed by Chinese people and has many new features:
• Compatible with Django Admin
• Use Bootstrap as the UI framework
• Flexible page layout editing
• Homepage dashboard and widgets
• Filter Enhancement
• Data Export
• Powerful plug-in mechanism
The following article will detail how to use xadmin in python 3.5 and how to solve possible problems. Let's take a look at the details below:
Installation Method
1. Copy the xadmin directory to your project.
2,pip install httplib2 django-formtools django-crispy-forms
# setting.pyINSTALLED_APPS = [ ..., 'xadmin', 'crispy_forms',]
# urls.pyimport xadminurlpatterns = [ url(r'^admin/', xadmin.site.urls)]
How to fix the "built-in" BUG of xadmin
After the Django User table is rewritten, a bug occurs in xadmin.
In the master Branch, I used UserProfile in users/models. py to overwrite the built-in auth_user table.
There will be two bugs:
1. xadmin cannot manage the rewritten User table
2. When you click Change Password in the upper right corner of the xadmin background page, an error is reported.
Repair procedure:
1. Add variables in settings. py
AUTH_USER_MODEL = "users.UserProfile"
2. Make the following changes in xadmin. plugins. auth.
from django.contrib.auth import get_user_modelUser = get_user_model()
An error will also be reported when the user changes the password. The password cannot be found on the 404 page.
Replace the url of register_view in xadmin. plugins. auth with the url with the error message.
site.register_view(r'^users/userprofile/(.+)/password/$', ChangePasswordView, name='user_change_password')
Summary
The above is all the content of this article. I hope the content of this article will help you in your study or work. If you have any questions, please leave a message, thank you for your support.