Daily Notes: Retail Website in Russian P2
Django:
Animate your element
after cloned a django project:
execute the following command
$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ pip install -r requirement.txt
(venv) $ pythong manage.py runserver 127.0.0.1:8080 #(or some other port)
Django admin site
$ python manage.py creatsuperusercreates users with attris_superuseroris_staffclass ModelAdminfromdjango.contrib.admin- if you need to make changes to the default admin interface, you need to create a object of
ModelAdminlike so:class AuthorAdmin(admin.ModelAdmin):, this representAuthormodel on admin dashboard - instead of registering like this:
admin.site.register(Author), you have to use a decorator to yourAuthorAdminclass like so:from django.contrib import admin from .models import Author from myproject.admin_site import custom_admin_site # Reader and Editor objects have to have a ForeignKey field pointing at Author @admin.register(Author, Reader, Editor, site=custom_admin_site) class AuthorAdmin(admin.ModelAdmin): pass - Create InlineModelAdmin object to display extra info on a model in admin add page.
- if you need to make changes to the default admin interface, you need to create a object of
Don Lee's Portfolio