README.md

    aaaa

    check
    compilemessages
    createcachetable
    dbshell
    diffsettings
    dumpdata
    flush
    inspectdb
    makemessages
    makemigrations
    migrate
    makemessages
    makemigrations
    migrate runserver sendtestemail shell showmigrations sqlflush sqlmigrate sqlsequencereset startapp startproject test testserver

    django-admin startproject python manage.py startapp python manage.py python manage.py makemigrations python manage.py migrate python manage.py runserver

    django-admin startproject python3 manage.py startapp python3 manage.py python3 manage.py makemigrations python3 manage.py migrate python3 manage.py runserver

    pip3 install django==3.2

    bbb

    django-snippets README This project is aimed at providing commonly used code snippets for Django to developers for faster development.

    Django Snippets

    Features Code Snippets for Django

    Model Fields Form Fields Queryset API Class Based View Function Based View User Model Snippet Documentation All the code snippets are according to Django 3.0. Arguments passed to certain fields take default values so it does not cause any issue.

    Model Snippets

    No. Snippet Function

    1. modclass Setup model class
    2. charfield Model CharField
    3. intfield Model IntField
    4. boolfield Model BoolField
    5. datefield Model DateField
    6. dtfield Model DateTimeField
    7. decimalfield Model DecimalField
    8. emailfield Model EmailField
    9. filefield Model FileField
    10. imagefield Model ImageField
    11. floatfield Model FloatField
    12. slugfield Model SlugField
    13. textfield Model TextField
    14. timefield Model TimeField
    15. urlfield Model URLField
    16. fkfield Model ForeignKey Field
    17. m2mfield Model ManyToMany Field
    18. otofield Model OneToOne Field

    Admin, URLs and Manager Snippets

    No. Snippet Function

    1. admreg admin.site.register(..)
    2. paturl Setup for urls.py file
    3. dmnc Custom Manager Setup
    4. cmmodel Custom Manager in Model

    Form Snippets

    No. Snippet Function

    1. formpy Setup form.py
    2. fclass Setup form class
    3. is_valid() Override is_valid()
    4. fchoicefield Form ChoiceField
    5. fmcfield Form MultipleChoiceField
    6. fcharfield Form CharField
    7. fintfield Form IntField
    8. fboolfield Form BoolField
    9. fdatefield Form DateField
    10. fdtfield Form DateTimeField
    11. fdecimalfield Form DecimalField
    12. femailfield Form EmailField
    13. ffilefield Form FileField
    14. ffloatfield Form FloatField
    15. fimagefield Form ImageField
    16. fslugfield Form SlugField
    17. ftimefield Form TimeField
    18. furlfield Form URLField Form field snippet shorcut are similar to model fields shortcuts. However the only difference is we have a f as the starting character of each snippet

    View Snippets

    No. Snippet Function

    1. gencbv Setup a generic class based view
    2. render Shortcut for render
    3. htrd Shortcut for HttpResponseRedirect
    4. cltd Cleaned Data Access for Forms
    5. custfilt Template for Custom Filter
    6. create Create query
    7. all All query
    8. filter Filter query
    9. get Get query
    10. exclude Exclude query
    11. goc Get or Create query
    12. uoc Update or Create query
    13. count Count query
    14. latest Latest query
    15. earliest Earliest query
    16. genfunc Setup a generic function view

    User Model Snippets

    No. Snippet Function

    1. createuser Create a new user instance
    2. validatepassword Validate a given password
    3. setpassword Set a new password
    4. authuser Authenticate a user
    5. checkauth Check if a user is authenticate Known Issues Currently no issue has been reported. All issues must be reported at

    Issues

    Current Release 0.0.4 Initial Release of the django-snippets extension Enjoy!

    Shortcuts/Commands

    Command Function !fbv Creates a function based view !cbv Creates a class based view !form Provides a sample for forms.Form !modelForm Provides a sample for model.ModelForm !model Provides a sample for model.Model !email Send email with one line !c_email Generates a function to send email with alternatives !paginate Provides a simple pagination code !django_pdf Generate pdf from html !object_404 Get Object or 404 !list_404 Get List or 404 !f_field Provides a ForeignKeyField sample !c_field Provides a Charfield sample !m2m_field Provides a ManyToMany field sample

    项目简介

    python,demo

    发行版本

    当前项目没有发行版本

    贡献者 3

    yuenblue @yuencczzy
    Y yuenblue @yuenblue
    Y yuenblue @yuenblue

    开发语言

    • JavaScript 59.9 %
    • Python 34.0 %
    • HTML 6.0 %
    • CSS 0.1 %
    • Batchfile 0.0 %