Coder Social home page Coder Social logo

saifeddine75 / django-class-based-views-unleashed-2021 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codingforentrepreneurs/django-class-based-views-unleashed-2021

0.0 0.0 0.0 31 KB

Learn all about Django Class Based Views in this tutorial series.

License: MIT License

Python 95.55% HTML 4.45%

django-class-based-views-unleashed-2021's Introduction

Django CBV Unleashed Logo

Django Class Based Views (CBVs) are an important part of using Django effectively. CBVs help us eliminate redundant code across our entire application and stay DRY while using CRUD and CRUD-like views.

Here's a basic example:

def my_home_view(request):
      return render(request, 'home.html', {})

Becomes

class MyHomeView(View):
     def get(self, request, *args, **kwargs):
          return render(request, 'home.html', {})


my_home_view = MyHomeView.as_view()

This, of course, isn't ground breaking. How about a detail view? or a List view?

class SomeModelListView(ListView):
     model = SomeModel
class SomeModelDetailView(DetailView):
     model = SomeModel

These two classes provide us a default template, a default lookup (for a QuerySet or object lookup), and default template context. These defaults can be reused for any model in your project.

This series will explore all of above and much more.

Recommend Experience

Watch the tutorial here

django-class-based-views-unleashed-2021's People

Contributors

codingforentrepreneurs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.