SlideShare ist ein Scribd-Unternehmen logo
1 von 10
Downloaden Sie, um offline zu lesen
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?

Weitere ähnliche Inhalte

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 

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?