Python Django

How To Operate Foreign Key And Many To Many Field In Django Model

This example is based on the article Django Bootstrap3 Example, it reuse the Department and Employee model class. Suppose Department and Employee model are many to many relationships, that means one department can have multiple employees and one employee can belong to multiple departments. Then we need to do the following changes.

How To Operate Foreign Key And Many To Many Field In Django Model Read More »

How To Install External Django Application To Django Project Correctly

We all know that one Django project can contain multiple applications, and all the applications should be activated in the Django project settings.py file INSTALLED_APPS section ( please read article How To Create / Remove Django Project Application ), but how to install external Django application developed by others in your local Django project? This

How To Install External Django Application To Django Project Correctly Read More »

How To Add Models To Django Admin Site

When you create a Django project and start the project built-in web server successfully, it also contains an admin website in this project. This admin website is the result of django.contrib.admin and django.contrib.auth Django applications. The Django project installed some default applications in the project settings.py file when you create it. You can find them in the INSTALLED_APPS section

How To Add Models To Django Admin Site Read More »

How To Pass Multiple Parameters Via Url In Django

If you find the Django url pattern is not easy to use when you want to pass multiple request parameters via url, you can use the original method to implement it. The original method is to use url like this http://127.0.0.1:8000/dept_emp/emp_list/?dept_id=1&user_name=jerry. It just adds the parameter name and value pair after the question mark (?) of

How To Pass Multiple Parameters Via Url In Django Read More »