SlideShare a Scribd company logo
1 of 10
Download to read offline
Django admin
       Petter Arvidsson
Software architect at Fyndiq AB
What is the Django admin
                   application?
●   It's a
    ●   framework for rapidly developing administrative
        backends
    ●   well integrated part of Django
●   It's not a
    ●   lightweight DBMS
        –    Doesn't compare to e.g. phpMyAdmin
    ●   CMS
        –    There exists applications that extends Django and admin
             to be a CMS
Admin in relation to Django
Model               Declarative   Change list
                    Inferred



                 ModelAdmin




ModelForm                         Change/add view
Models
           Model                            Change
                                            list
                                                            ●   Everyone knows
                           Model
                                                                about Models, right?
                           Admin

           Model                            Change
                                                            ●   Declarative definitions
           Form                             /add
                                            view                of data bundles
                                                            ●   Provides validation
●   Tip
    ●   Model fields contains several options that are
        directly linked to their behaviour in ModelForms
                                                            ●   Provides data
    ●
        (and therefore indirectly in admin):
        Blank, choices, editable, help_text, verbose_name
                                                                consistency
ModelForms
          Model                           Change
                                                          ●   Fields are declared from the
                                          list
                                                              Fields present in the Model
                          Model
                          Admin                           ●   Provides validation
          Model
          Form
                                          Change
                                          /add
                                                              ●   Including user friendly error
                                          view
                                                                  messages
                                                          ●   Renders as HTML
●   Tip                                                       ●   Including error messages
    ●   Forms keeps tracks of which fields that have
        changed. A model form that is given an instance
        will automatically populate the changed_data
                                                          ●   Easily customizable
        property with any fields that were changed
                                                          ●   Can create or update a
                                                              bound model instance
Admin in relation to Django
Model               Declarative   Change list
                    Inferred



                 ModelAdmin




ModelForm                         Change/add view
ModelAdmin
          Model                    Change
                                                ●   Defines the change list and
                                   list
                                                    the change/add view
                      Model
                      Admin                     ●   Customizable
          Model                    Change           ●   Change list
          Form                     /add
                                   view                 –   Columns
                                                        –   Sorting
                                                        –   Search
●   Tip                                                 –   Filtering
    ●   ModelAdmins can inherit in the same             –   …
        way as Models can inherit. A powerful
        pattern is to complement abstract
                                                    ●   Change/add view
        models with ModelAdmin classes                  –   Fields
                                                        –   Inline
                                                        –   Create your own ModelForm
                                                        –   …
Admin actions
        Model                 Change
                                            ●   Bulk actions on steroids
                              list
                                                ●   Filter, search, select and then
                   Model
                   Admin
                                                    execute
        Model                 Change
                                            ●   Define your own actions
        Form                  /add
                              view              ●   Actions are methods on the
                                                    ModelAdmin
                                                ●   Global actions (generic for all
●   Tip                                             models)
    ●   Use admin actions to filter other       ●   Local actions (specialized for
        admin views                                 one model)
    ●   E.g. select an author and
        create an action to show all
        books written by her/him
Result
          Model                              Change
                                             list
                                                              ●   Well defined, user
                            Model
                                                                  friendly administrative
                            Admin
                                                                  interfaces
          Model                              Change
          Form                               /add
                                             view             ●   Extremely short
                                                                  development times
●   Tip
    ●   The fact that Django is highly modular does not
        by itself imply that it's a good idea to start only
        using a limited amount of modules. E.g. if you
        build your application only using Models it might
        be really hard to add Forms and Admin later on
Where to go next?
●   Django documentation
●   James Bennet, Django in Depth at PyCon US
    2012 (available from youtube.com)
●   Django/contrib/admin/
●   Join us?

More Related Content

Similar to Django admin

No magic@md day2011
No magic@md day2011No magic@md day2011
No magic@md day2011
MDDAY11
 
Solution de génération de rapport OpenDocument à partir de plusieurs sources ...
Solution de génération de rapport OpenDocument à partir de plusieurs sources ...Solution de génération de rapport OpenDocument à partir de plusieurs sources ...
Solution de génération de rapport OpenDocument à partir de plusieurs sources ...
EclipseDayParis
 
Trasnformation Design Patterns - Sandeep Katoch
Trasnformation Design Patterns - Sandeep KatochTrasnformation Design Patterns - Sandeep Katoch
Trasnformation Design Patterns - Sandeep Katoch
Roopa Nadkarni
 
2 trasnformation design_patterns-sandeep_katoch
2 trasnformation design_patterns-sandeep_katoch2 trasnformation design_patterns-sandeep_katoch
2 trasnformation design_patterns-sandeep_katoch
IBM
 
An introduction to the MDA
An introduction to the MDAAn introduction to the MDA
An introduction to the MDA
Lai Ha
 

Similar to Django admin (19)

No magic@md day2011
No magic@md day2011No magic@md day2011
No magic@md day2011
 
Mixing Diagram, Tree, Text, Table and Form editors to build a kick-ass modeli...
Mixing Diagram, Tree, Text, Table and Form editors to build a kick-ass modeli...Mixing Diagram, Tree, Text, Table and Form editors to build a kick-ass modeli...
Mixing Diagram, Tree, Text, Table and Form editors to build a kick-ass modeli...
 
Solution de génération de rapport OpenDocument à partir de plusieurs sources ...
Solution de génération de rapport OpenDocument à partir de plusieurs sources ...Solution de génération de rapport OpenDocument à partir de plusieurs sources ...
Solution de génération de rapport OpenDocument à partir de plusieurs sources ...
 
Joomla Extensions Kung Fu
Joomla Extensions Kung FuJoomla Extensions Kung Fu
Joomla Extensions Kung Fu
 
Ozone presentation
Ozone presentationOzone presentation
Ozone presentation
 
Trasnformation Design Patterns - Sandeep Katoch
Trasnformation Design Patterns - Sandeep KatochTrasnformation Design Patterns - Sandeep Katoch
Trasnformation Design Patterns - Sandeep Katoch
 
2 trasnformation design_patterns-sandeep_katoch
2 trasnformation design_patterns-sandeep_katoch2 trasnformation design_patterns-sandeep_katoch
2 trasnformation design_patterns-sandeep_katoch
 
197 ssp seminar05_murphy
197 ssp seminar05_murphy197 ssp seminar05_murphy
197 ssp seminar05_murphy
 
2007 Services Records Updating Procedure
2007 Services Records Updating Procedure2007 Services Records Updating Procedure
2007 Services Records Updating Procedure
 
What's New in newforms-admin
What's New in newforms-adminWhat's New in newforms-admin
What's New in newforms-admin
 
Features module in drupal 8
Features module in drupal 8Features module in drupal 8
Features module in drupal 8
 
Workflow for XPages
Workflow for XPagesWorkflow for XPages
Workflow for XPages
 
HANA SPS07 Modeling Enhancements
HANA SPS07 Modeling EnhancementsHANA SPS07 Modeling Enhancements
HANA SPS07 Modeling Enhancements
 
An introduction to the MDA
An introduction to the MDAAn introduction to the MDA
An introduction to the MDA
 
The MVVM Pattern
The MVVM PatternThe MVVM Pattern
The MVVM Pattern
 
Benefits of using software design patterns and when to use design pattern
Benefits of using software design patterns and when to use design patternBenefits of using software design patterns and when to use design pattern
Benefits of using software design patterns and when to use design pattern
 
Design Patterns (Examples in .NET)
Design Patterns (Examples in .NET)Design Patterns (Examples in .NET)
Design Patterns (Examples in .NET)
 
Tech talk live content type and form design tools
Tech talk live content type and form design toolsTech talk live content type and form design tools
Tech talk live content type and form design tools
 
Talk at ICTM '12
Talk at ICTM '12Talk at ICTM '12
Talk at ICTM '12
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

Django admin

  • 1. Django admin Petter Arvidsson Software architect at Fyndiq AB
  • 2. What is the Django admin application? ● It's a ● framework for rapidly developing administrative backends ● well integrated part of Django ● It's not a ● lightweight DBMS – Doesn't compare to e.g. phpMyAdmin ● CMS – There exists applications that extends Django and admin to be a CMS
  • 3. Admin in relation to Django Model Declarative Change list Inferred ModelAdmin ModelForm Change/add view
  • 4. Models Model Change list ● Everyone knows Model about Models, right? Admin Model Change ● Declarative definitions Form /add view of data bundles ● Provides validation ● Tip ● Model fields contains several options that are directly linked to their behaviour in ModelForms ● Provides data ● (and therefore indirectly in admin): Blank, choices, editable, help_text, verbose_name consistency
  • 5. ModelForms Model Change ● Fields are declared from the list Fields present in the Model Model Admin ● Provides validation Model Form Change /add ● Including user friendly error view messages ● Renders as HTML ● Tip ● Including error messages ● Forms keeps tracks of which fields that have changed. A model form that is given an instance will automatically populate the changed_data ● Easily customizable property with any fields that were changed ● Can create or update a bound model instance
  • 6. Admin in relation to Django Model Declarative Change list Inferred ModelAdmin ModelForm Change/add view
  • 7. ModelAdmin Model Change ● Defines the change list and list the change/add view Model Admin ● Customizable Model Change ● Change list Form /add view – Columns – Sorting – Search ● Tip – Filtering ● ModelAdmins can inherit in the same – … way as Models can inherit. A powerful pattern is to complement abstract ● Change/add view models with ModelAdmin classes – Fields – Inline – Create your own ModelForm – …
  • 8. Admin actions Model Change ● Bulk actions on steroids list ● Filter, search, select and then Model Admin execute Model Change ● Define your own actions Form /add view ● Actions are methods on the ModelAdmin ● Global actions (generic for all ● Tip models) ● Use admin actions to filter other ● Local actions (specialized for admin views one model) ● E.g. select an author and create an action to show all books written by her/him
  • 9. Result Model Change list ● Well defined, user Model friendly administrative Admin interfaces Model Change Form /add view ● Extremely short development times ● Tip ● The fact that Django is highly modular does not by itself imply that it's a good idea to start only using a limited amount of modules. E.g. if you build your application only using Models it might be really hard to add Forms and Admin later on
  • 10. Where to go next? ● Django documentation ● James Bennet, Django in Depth at PyCon US 2012 (available from youtube.com) ● Django/contrib/admin/ ● Join us?