Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source.
Following is the agenda of the meetup:
1. How to get started with Django
2. Advanced overview of Django components
1. Views
2. Models
3. Templates
4. Middlewares
5. Routing
3. Deep dive into Django ORM
4. How to write complex Django queries using Model Managers, Query Sets and Q library
5. How do Django models work internally
Whether you're a newer Django developer wanting to improve your understanding of some key concepts, or a seasoned Djangonaut, there should be something for you.
Templates in Django - Python, How to use master page in Django using Templates, How to fix TemplateDoesNotExist at error in Django. How to run Django applications in Windows. How a Django view works.
Learn to use ZopeSkel and the extensibility of the underlying templer system to create skeleton templates that support your needs as a developer. Spend minutes instead of hours starting new projects so you can use your time for your customers' code.
Stop Hacking WordPress, Start Working with it - Charly Leetham - WordCamp Syd...WordCamp Sydney
Many developers know how to write code in php but that doesn't mean they can write code for Wordpress.
When developing sites for clients in Wordpress, it sometimes preferably to write a custom function that will simplify data input, management and display.
The Wordpress coding framework is continually evolving and provides a number of hooks (through actions & filters) to allow developers to quickly and easily grab functions to create world class websites.
Charly will speak about the power of hooks and filters and explain some of the most common ones to use if you want to write your own custom functions, to make the management of your wordpress websites a breeze.
A talk delivered to the Philadelphia Python User Group on 09/17/15
Models form the backbone of most Django sites. They contain the fields and behaviors of the data your site is using. The proper planning and implementation of models is one of the first steps to creating powerful and reusable Django apps. It’s also crucial for avoiding pitfalls and complex workarounds down the line. In this talk you’ll hear about: -
• Django model fields and methods
• Model inheritance
• Relational databases
• Migrations
• How to access the data stored within your models
Page Object Model and Implementation in Selenium Zoe Gilbert
There are various frameworks that have been used by the IT industry for robust, easy maintenance, and to automate their applications to make them flexible and reusable. Page Object Model is one of the frameworks that have been covered here in this blog step by step clearly to help you understand.
Templates in Django - Python, How to use master page in Django using Templates, How to fix TemplateDoesNotExist at error in Django. How to run Django applications in Windows. How a Django view works.
Learn to use ZopeSkel and the extensibility of the underlying templer system to create skeleton templates that support your needs as a developer. Spend minutes instead of hours starting new projects so you can use your time for your customers' code.
Stop Hacking WordPress, Start Working with it - Charly Leetham - WordCamp Syd...WordCamp Sydney
Many developers know how to write code in php but that doesn't mean they can write code for Wordpress.
When developing sites for clients in Wordpress, it sometimes preferably to write a custom function that will simplify data input, management and display.
The Wordpress coding framework is continually evolving and provides a number of hooks (through actions & filters) to allow developers to quickly and easily grab functions to create world class websites.
Charly will speak about the power of hooks and filters and explain some of the most common ones to use if you want to write your own custom functions, to make the management of your wordpress websites a breeze.
A talk delivered to the Philadelphia Python User Group on 09/17/15
Models form the backbone of most Django sites. They contain the fields and behaviors of the data your site is using. The proper planning and implementation of models is one of the first steps to creating powerful and reusable Django apps. It’s also crucial for avoiding pitfalls and complex workarounds down the line. In this talk you’ll hear about: -
• Django model fields and methods
• Model inheritance
• Relational databases
• Migrations
• How to access the data stored within your models
Page Object Model and Implementation in Selenium Zoe Gilbert
There are various frameworks that have been used by the IT industry for robust, easy maintenance, and to automate their applications to make them flexible and reusable. Page Object Model is one of the frameworks that have been covered here in this blog step by step clearly to help you understand.
This is the slides I used when I shared my humble insight on Django to the students in University of Taipei in 2016. Please feel free to correct me if there is anything wrong.
How can we harness AEM6 and Sling to integrate backed layers to the CMS and expose them as a unified framework. creation of these integrations is vital for a coherent, personalize-able and track-able sites.
Super keyword is a reference variable that is used for refer parent class object. Super keyword is used in java at three level, at variable level, at method level and at constructor level.
Performance Tuning with JPA 2.1 and Hibernate (Geecon Prague 2015)Thorben Janssen
The Java Persistence API (JPA) is the standard way for Java EE applications to persist data in a database. The application server provides all required libraries and is so easy to use that you can learn it within a few hours. But that changes as soon as it gets more complex and the application needs to support a huge amount of data or if you want to guarantee very short response times.
These requirements can also be fulfilled by JPA and on top of that, there are several Hibernate specific features allowing even more optimizations. Some examples are selecting the right fetch strategy, using different caches and performing bulk operations. But using them efficiently requires far more knowledge.
During this talk, you will get an overview about these and other advanced features that can be used to meet challenging performance requirements. You should already have practical experience with JPA and Hibernate.
This isn't a talk about microservices, NO-SQL, Container solutions or hip new frameworks. This talk will show some of the standard Java APIs that are part of Java since version 5, 6, 7 or 8. All this features are very helpful to create maintainable and future-proof applications, regardless of whether JavaEE, Spring, JavaFX or any other framework is used. The talk will give an overview of some important standard concepts and APIs of Java like annotations, SPI or how to handle null values. Based on an overview of this topics and some samples the talk will answer questions like:
- How can I create my own annotations?
- How can I create a plugin structure without using frameworks like OSGI?
- What's the best way to handle NullPointerExceptions?
Drupal8 modernization (new object-oriented base) and adoption of many Symfony components is a huge step in connecting these two amazing communities and amazing projects. Drupal8 is not powered by full-stack Symfony and there is still many differences between these two relatives, but still, Symfony developers should master it easily.
This talk is for Symfony developers who don't have experience with Drupal8. It will guide you through routing, controllers, hooks, events, Drupal Console, DI and many other interesting elements that power Drupal8 under the hood. It will also show how to build custom modules Symfony way.
Coding with style: The Scalastyle style checkerMatthew Farwell
Coding with style: The Scalastyle style checker
Scalastyle is a static code analysis tool that helps programmers write Scala code according to the coding standards their project.
It is heavily influenced by Checkstyle, PMD and FindBugs for Java. These tools are used by java developers everywhere, and Scalastyle will help Scala gain more acceptance within companies.
Scalastyle can check many aspects of your code. It has as goals:
- to check the style of your code according to house style (usage of tabs, correct whitespace usage),
- coding conventions (too many parameters to a method, usage of disallowed libraries, usage of return)
- and code which exhibits bug patterns (equals and hashCode not implemented in the same class).
Currently, scalastyle works as standalone, and there is an Eclipse plugin, and plugins for sbt and maven are planned.
In this talk, we discuss why we're creating Scalastyle, what it currently does (the rules that are checked), and how it does it (using the wonderful Scalariform), along with the current state of third part integration (Eclipse, Maven).
InterConnect2016: WebApp Architectures with Java and Node.jsChris Bailey
Java has been the historical leader for enterprise web application development. However, Node.js is rapidly gaining in popularity for developing mobile apps, APIs and web applications. Java and Node.js are complimentary tools for enterprise web application development and this session will highlight the strengths and complimentary nature of each.
Presented at IBM InterConnect 2016
Enterprise makeover. Be a good web citizen, deliver continuously and change y...Mateusz Kwasniewski
Microservices, cloud, continuous delivery heavily influenced how modern teams build software systems. Come to this talk to learn how our team rebuild frontend stack of several newspapers significantly reducing cycle time and creating fun work environment that lets great developers be great.
Some of the things I’ll share:
- how respecting the Web makes us faster
- what we learned running 12factor apps on Heroku
- nuances of Continuous Delivery that you won’t find in books
- thinking process behind our decisions and some of the change patterns we used
Video:
http://www.schibsted.pl/2015/07/enterprise-makeover-part-16-creating-lean-enterprise/
http://www.schibsted.pl/2015/07/enterprise-makeover-part-26-use-the-web-dont-abuse-it/
http://www.schibsted.pl/2015/07/enterprise-makeover-part-36-rethinking-agile-practices/
http://www.schibsted.pl/2015/07/enterprise-makeover-part-46-cloud-native-development-on-heroku/
http://www.schibsted.pl/2015/07/enterprise-makeover-part-56-continuous-delivery-orchestration/
http://www.schibsted.pl/2015/07/enterprise-makeover-66-organizational-change-summary/
- jak tworzyć testowalne aplikacje stosując wzorzec Dependency Injection (bez frameworków!).
- jak node.js pomógł rozwiązać problemy kulturowe a programiści przestali nadużywać Single Page App'y
- jak komunikować się po HTTP z niestabilnymi mikrousługami
- jak automatyzować infrastrukturę Heroku z użyciem kodu JS
Carly Rae Jepsen pomoże mi wytłumaczyć dlaczego nie używamy callbacków.
A na koniec zdradzę dlaczego jestem gruby od tego JS.
Managing and Versioning Machine Learning Models in PythonSimon Frid
Practical machine learning is becoming messy, and while there are lots of algorithms, there is still a lot of infrastructure needed to manage and organize the models and datasets. Estimators and Django-Estimators are two python packages that can help version data sets and models, for deployment and effective workflow.
How to Write a Popular Python Library by AccidentDaniel Greenfeld
We gave this talk as the opening keynote speech at PyCon Singapore. The theme of the talk is that most complex projects begin from humble origins. That you should create your own projects, sharing your knowledge and expertise.
This is the slides I used when I shared my humble insight on Django to the students in University of Taipei in 2016. Please feel free to correct me if there is anything wrong.
How can we harness AEM6 and Sling to integrate backed layers to the CMS and expose them as a unified framework. creation of these integrations is vital for a coherent, personalize-able and track-able sites.
Super keyword is a reference variable that is used for refer parent class object. Super keyword is used in java at three level, at variable level, at method level and at constructor level.
Performance Tuning with JPA 2.1 and Hibernate (Geecon Prague 2015)Thorben Janssen
The Java Persistence API (JPA) is the standard way for Java EE applications to persist data in a database. The application server provides all required libraries and is so easy to use that you can learn it within a few hours. But that changes as soon as it gets more complex and the application needs to support a huge amount of data or if you want to guarantee very short response times.
These requirements can also be fulfilled by JPA and on top of that, there are several Hibernate specific features allowing even more optimizations. Some examples are selecting the right fetch strategy, using different caches and performing bulk operations. But using them efficiently requires far more knowledge.
During this talk, you will get an overview about these and other advanced features that can be used to meet challenging performance requirements. You should already have practical experience with JPA and Hibernate.
This isn't a talk about microservices, NO-SQL, Container solutions or hip new frameworks. This talk will show some of the standard Java APIs that are part of Java since version 5, 6, 7 or 8. All this features are very helpful to create maintainable and future-proof applications, regardless of whether JavaEE, Spring, JavaFX or any other framework is used. The talk will give an overview of some important standard concepts and APIs of Java like annotations, SPI or how to handle null values. Based on an overview of this topics and some samples the talk will answer questions like:
- How can I create my own annotations?
- How can I create a plugin structure without using frameworks like OSGI?
- What's the best way to handle NullPointerExceptions?
Drupal8 modernization (new object-oriented base) and adoption of many Symfony components is a huge step in connecting these two amazing communities and amazing projects. Drupal8 is not powered by full-stack Symfony and there is still many differences between these two relatives, but still, Symfony developers should master it easily.
This talk is for Symfony developers who don't have experience with Drupal8. It will guide you through routing, controllers, hooks, events, Drupal Console, DI and many other interesting elements that power Drupal8 under the hood. It will also show how to build custom modules Symfony way.
Coding with style: The Scalastyle style checkerMatthew Farwell
Coding with style: The Scalastyle style checker
Scalastyle is a static code analysis tool that helps programmers write Scala code according to the coding standards their project.
It is heavily influenced by Checkstyle, PMD and FindBugs for Java. These tools are used by java developers everywhere, and Scalastyle will help Scala gain more acceptance within companies.
Scalastyle can check many aspects of your code. It has as goals:
- to check the style of your code according to house style (usage of tabs, correct whitespace usage),
- coding conventions (too many parameters to a method, usage of disallowed libraries, usage of return)
- and code which exhibits bug patterns (equals and hashCode not implemented in the same class).
Currently, scalastyle works as standalone, and there is an Eclipse plugin, and plugins for sbt and maven are planned.
In this talk, we discuss why we're creating Scalastyle, what it currently does (the rules that are checked), and how it does it (using the wonderful Scalariform), along with the current state of third part integration (Eclipse, Maven).
InterConnect2016: WebApp Architectures with Java and Node.jsChris Bailey
Java has been the historical leader for enterprise web application development. However, Node.js is rapidly gaining in popularity for developing mobile apps, APIs and web applications. Java and Node.js are complimentary tools for enterprise web application development and this session will highlight the strengths and complimentary nature of each.
Presented at IBM InterConnect 2016
Enterprise makeover. Be a good web citizen, deliver continuously and change y...Mateusz Kwasniewski
Microservices, cloud, continuous delivery heavily influenced how modern teams build software systems. Come to this talk to learn how our team rebuild frontend stack of several newspapers significantly reducing cycle time and creating fun work environment that lets great developers be great.
Some of the things I’ll share:
- how respecting the Web makes us faster
- what we learned running 12factor apps on Heroku
- nuances of Continuous Delivery that you won’t find in books
- thinking process behind our decisions and some of the change patterns we used
Video:
http://www.schibsted.pl/2015/07/enterprise-makeover-part-16-creating-lean-enterprise/
http://www.schibsted.pl/2015/07/enterprise-makeover-part-26-use-the-web-dont-abuse-it/
http://www.schibsted.pl/2015/07/enterprise-makeover-part-36-rethinking-agile-practices/
http://www.schibsted.pl/2015/07/enterprise-makeover-part-46-cloud-native-development-on-heroku/
http://www.schibsted.pl/2015/07/enterprise-makeover-part-56-continuous-delivery-orchestration/
http://www.schibsted.pl/2015/07/enterprise-makeover-66-organizational-change-summary/
- jak tworzyć testowalne aplikacje stosując wzorzec Dependency Injection (bez frameworków!).
- jak node.js pomógł rozwiązać problemy kulturowe a programiści przestali nadużywać Single Page App'y
- jak komunikować się po HTTP z niestabilnymi mikrousługami
- jak automatyzować infrastrukturę Heroku z użyciem kodu JS
Carly Rae Jepsen pomoże mi wytłumaczyć dlaczego nie używamy callbacków.
A na koniec zdradzę dlaczego jestem gruby od tego JS.
Managing and Versioning Machine Learning Models in PythonSimon Frid
Practical machine learning is becoming messy, and while there are lots of algorithms, there is still a lot of infrastructure needed to manage and organize the models and datasets. Estimators and Django-Estimators are two python packages that can help version data sets and models, for deployment and effective workflow.
How to Write a Popular Python Library by AccidentDaniel Greenfeld
We gave this talk as the opening keynote speech at PyCon Singapore. The theme of the talk is that most complex projects begin from humble origins. That you should create your own projects, sharing your knowledge and expertise.
The Lone Star State is well known for being large in size, but did you know that they are also a major technology hub? Texas ranks only second to California in the number of technology jobs in America. In this infographic, Experts Exchange highlights the growth of the industry in Texas and takes a look at employment across technology jobs within the state. See how it stacks up next to other states, and explore the showdown between the two growing hubs of Austin and Dallas.
Slides from our CodeMash 2013 Precompiler session, "Web Development with Python and Django", including a breezy introduction to the Python programming language and the Django web framework. The example code repository is available at https://github.com/finiteloopsoftware/django-precompiler/
Keynote address (Feb, 2016) to the educators in the Fort Nelson school district. We all know that we cannot teach a child without a concection... without a relationship. In the hustle and bustle of our jobs as educators, we often forget our why, the reason we got into education, of trying to make a difference with kids. In this talk, 6 Keys to Connecting are shared and discussed with the challenge of creating a more positive climate and better connections with kids in our classrooms, schools, and organizations.
With the explosion of the maker movement, schools are beginning to embrace creativity. However, what does this mean for assessment? Should we assess the creative process? Should we assess the finished product? Does assessing creativity actually make kids more risk-averse? In this workshop we explore what it means to assess both the creative process and the creative product without leading to risk aversion.
A Web Framework that shortens the Time it takes to develop software in at least an Order of Magnitude. while also tremendously minimizing Effort Pain, Time waste, Complexity, Cost of change & more
Youtube Link: https://youtu.be/C1OfG7IK5jo
** Python Django Training: https://www.edureka.co/python-django **
This Edureka PPTon "Django Interview Questions and Answers" will help you understand the 50 most asked Django Interview Questions with their best answers. It will help in preparing for your upcoming Django Developer Interviews.
Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in
Rapid web application development using django - Part (1)Nishant Soni
This slide contains deatils about Django Framework which is based in Python. Beginners to this technology can first learn about the technology and its uses and than start building their project. Popular website like Pinterest, Instagram, Nasa are examples of web application built in Django Framework. This is part 1 .
Get things done with Yii - quickly build webapplicationsGiuliano Iacobelli
Lesson teached at Università di Roma Tre - Software Engineering course.
Web is plenty of amazing tools used daily by millions of people. A good idea can turn to be a highly profitable business if well executed. Yii framework is an ideal tool to build in short time an MVP of your product to start as soon as possible to find your market fit. Here follows some infos about the framework and steps on how to build a simple blog over Yii.
Slide del corso di AngularJs Intermediate tenuto da LinkMe. Si affronteranno argomenti come l’estensione dell’html tramite direttive, la gestione di chiamate a un server API, crud e non solo, gestione di errori del server, validazione di form e alcuni principi del testing automatico.
BackboneJS Training - Giving Backbone to your applicationsJoseph Khan
BackboneJS Training PPT Slides. Giving Backbone to your applications.
Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
Similar to Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com] (20)
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
1. DJANGO APPS AND ORM
PRODUCT VALLEY MEETUP GROUP BANGALORE (A PRODEERS CHAPTER)
- BY UDIT GANGWANI
2. ABOUT ME
I WEAR MULTIPLE HATS
SOFTWARE DEVELOPER
PRODUCT MANAGER
ENTREPRENEUR
I LOVE TO TRAVEL
MY FRIENDS CALL ME PIZZA MANIAC
3. WHAT WILL WE LEARN TODAY
INTRODUCTION TO DJANGO
HOW TO GET STARTED WITH DJANGO
COMPONENTS OF DJANGO FRAMEWORK
DJANGO MODELS, MODEL MANAGERS AND QUERY SETS
HOW DO DJANGO MODELS WORK
4. WHAT IS DJANGO ?
Django is a high-level Python Web framework that encourages rapid
development and clean, pragmatic design. Built by experienced developers, it
takes care of much of the hassle of Web development, so you can focus on
writing your app without needing to reinvent the wheel.
-- https://www.djangoproject.com/
5. WHY DJANGO ?
• Incredible programming language (Python)
• Perfect ORM for handling database
• Offers great control (Explicit is better than implicit)
• Django Admin GUI
• Simple and smaller footprint to get started
• Very big & active community
• Lots of Django packages for almost every functionality
• Support for large variants of Databases
• Django REST Framework
6. MTV ARCHITECTURE
Django follows MTV architecture:
M – Model
• app/models.py
V – View
• app/views.py
T – Templates
• app/templates/*.html
It is analogous to MVC architecture.
View in MVC corresponds to
Template in MTV
Controller in MVC corresponds to
View in MTV
7. POPULAR SITES BUILT WITH DJANGO
• Pinterest
• Instagram
• Discus
• Spotify
• Washington Post
• Firefox
• NASA
• BitBucket
• Prezi
• EventBrite
9. ENVIRONMENT SETUP
• Standard Environment
• Common environment and set of packages for each project on your system
• Virtual Environment
• Isolated environment for each Django project
• No limits on the number of environments
• Can have different python version for each project
• Using virtualenv or pyenv
11. GETTING STARTED WITH DJANGO
• Install Django using pip
• Create a project using django-admin
• Create your database
• Configure DB settings in settings.py
• Define your models
• Add external modules
• Write your Templates
• Define your Urls
• Write your Views and bind them to Urls
• Test application
• Deploy application using NginX or Apache
12. DJANGO PROJECT STRUCTURE
• Each Django app is a Python Package
• Each app contains one or more Python
modules (files of python code)
• To form a package every app directory
must contain an __init__.py file
15. URL’S DISPATCHER/ROUTING
• Django determines the root URLconf module to use
• Django loads the Python module and looks for the variable urlpatterns
• Django runs through each pattern and stops at the one which matches
• Once the regex matches, Django calls the given View
16. VIEWS
• A Django view is a callable which takes a request and returns a response
17. MODELS & MODEL FIELDS
• Each model maps to a single database table.
• Each model is a Python class that subclasses django.db.models.Model
• Each attribute of the model represents a database field
18. TEMPLATES
• A template contains the static parts of the desired HTML output as well as
some special syntax describing how dynamic content will be inserted
19. MIDDLEWARES
• Middleware is a framework of hooks into Django’s request/response
processing. It’s a light, low-level “plugin” system for globally altering
Django’s input or output.
21. MIGRATIONS
• Migrations are Django’s way of propagating changes you make to your
models (adding a field, deleting a model, etc.) into your database schema.
• They’re designed to be mostly automatic
Thereareseveralcommandswhichyouwilluse tointeractwithmigrations:
•migrate,whichisresponsibleforapplyingmigrations,aswellas unapplyingandlistingtheirstatus.
•makemigrations,whichisresponsibleforcreatingnewmigrationsbasedonthechangesyouhavemadetoyourmodels.
•sqlmigrate,whichdisplaystheSQLstatementsforamigration.
•showmigrations,whichlistsaproject’smigrations.
23. MODEL QUERIES
• Creating Objects
• Retrieving Objects
• Create query set objects using your model manager. A query set represents the
collection of objects from database
• Query sets are lazy
• Retrieving specific objects using filters
24. MODEL QUERIES ON RELATED OBJECTS
One to Many Field
One to One Many Reverse lookup
Many to Many Field
One to One Field
25. MANAGERS
• A Manager is the interface through which database query operations are
provided to Django models. At least one Manager exists for every model in a
Django application.
• Adding extra Manager methods is the preferred way to add “table-level”
functionality to your models. (For “row-level” functionality – i.e., functions
that act on a single instance of a model object – use Model methods, not
custom Manager methods.)
27. QUERY SETS
• Internally, a QuerySet can be constructed, filtered, sliced, and generally
passed around without actually hitting the database. No database activity
actually occurs until you do something to evaluate the queryset.
• Important methods that return new Query set
• filter(), exclude(), annotate(), order_by(), reverse(), distinct(), values(), all()
• Important methods that do not return Query set
• get(), create(), update(), aggregate(), iterator(), count()
28. Q OBJECTS
• A Q object (django.db.models.Q) is an object used to encapsulate a
collection of keyword arguments. It is used to execute more complex queries
(for example, queries with OR statements)
31. HOW DO MODELS WORK - METACLASSES
Lets understand what goes on from the time a model is imported until an
instance is created by the user.
Lets look at an example model
32. HOW DO MODELS WORK - METACLASSES
So ModelBase.__new__ is called to create this new Example class. It is important to realise that we are
creating the class object here, not an instance of it
The Model class (see base.py) has a __metaclass__ attribute that defines ModelBase (also in base.py) as
the class to use for creating new classes.
The __new__ method is required to return a class object that can then be instantiated (by calling
Example() in our case).
A new class object with the Example name is created in the right module namespace. A _meta attribute
is added to hold all of the field validation, retrieval and saving machinery
33. HOW DO MODELS WORK - METACLASSES
Each attribute is then added to the new class object. Putting this in the context of our example, the
static and __unicode__ attributes would be added normally to the class as a string object and unbound
method, respectively.
In case of Field, it does not add the new attribute to the class we are creating (Example). Instead it adds
itself to the Example._meta class, ending up in the Example._meta.fields list
The ModelBase._prepare method is called. This sets up a few model methods that might be required
depending on other options you have selected and adds a primary key field if one has not been explicitly
declared.
The registration is done right at the end of the ModelBase.__new__ method. The register_models()
function in loaders.py
34. REFERENCES
• Django Orm at Django under the hood: https://www.youtube.com/watch?v=CGF-0csOjPw
• Django Topics: https://docs.djangoproject.com/en/1.9/topics/
• What is a MetaClass in Python: http://stackoverflow.com/questions/100003/what-is-a-
metaclass-in-python
• How do Django Models work:
• http://stackoverflow.com/questions/12006267/how-do-django-models-work
• https://code.djangoproject.com/wiki/DevModelCreation
• Django Cookbook: https://code.djangoproject.com/wiki/CookBook
• Python3 Cookbook: http://python3-
cookbook.readthedocs.io/zh_CN/latest/c09/p18_define_classes_programmatically.html
35. REFERENCES
• Try Django Blog Project:
• https://github.com/codingforentrepreneurs/try-django-19
• https://www.codingforentrepreneurs.com/projects/try-django-19/
• Django Models and Migrations:
• http://www.webforefront.com/django/setupdjangomodels.html
• Making Django Queries :
• https://docs.djangoproject.com/en/1.9/topics/db/queries/
• Understanding Django Model Managers and QuerySets:
• https://docs.djangoproject.com/en/1.9/ref/models/querysets/
• https://docs.djangoproject.com/en/1.9/topics/db/managers/