Django Admin Tutorial - Full Customization (2018)

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ส.ค. 2024
  • 7 Tips For Getting Better At Django:
    mailchi.mp/dea...
    In this video you will learn how to customize the django admin view.
    django-suit package license:
    djangosuit.com/...
    Starting point for this tutorial:
    github.com/Rec...
    You are going to learn:
    - how to register and unregister models
    - how to add filtering
    - how to add a custom input and button which update a field on all objects
    - how to change the theme using the django-suit package.
    Registering and unregistering models is quite easy. Simple use the admin.site.register/admin.site.unregister functions and provide them with the model.
    In order to take our customization further, we'll then create an admin class for the snippet and alter various attributes, such as filter, exclude, list_display, list_filter.
    To include an input with a button, we'll need to override the change_list_template attribute and set it to our desired path. In the template, we'll then extend from admin/change_list.html, and can now override the various blocks. For our custom behaviour to work, we'll set up a form with an action, override the get_urls() to include a custom path we'll create that the form will then navigate to, and finally write a view that will handle our request.
    Configuring our custom theme is easy. We'll pip install django-suit, create a custom SuitConfig and include it in our INSTALLED_APPS in the settings.py. Now, we can alter the SuitConfig attributes to "suit" (that wordplay...) our needs.
    Anyway, you can find the step-by-steps instructions in this video.
    If you enjoyed this video, make sure to subscribe and share it with anyone you think could enjoy it as well.
    I hope to see you inside of the next episode,
    Cheers.

ความคิดเห็น • 137

  • @alexdin1565
    @alexdin1565 ปีที่แล้ว +2

    thanks you are the life saver you are the only one who cover this topic
    please add more videos about admin Customization if you can because no one talk about it before

  • @hrvojelo3853
    @hrvojelo3853 3 ปีที่แล้ว +9

    Usually I don't comment on TH-cam, but I have to say that this video is AMAZING !!! The speed of presenting is really great - it's amazing how much I learnt and how many new ideas I got in only 14 minutes. Thanks !

  • @foreducation5107
    @foreducation5107 3 ปีที่แล้ว +9

    Only Tutorial That Actually Shows How To Customize Django Admin.

    • @bigstepper4125
      @bigstepper4125 2 ปีที่แล้ว

      For real man. you'll spend a whole day just listening to people tell you what you already know. I'm subscribing to this channel

  • @Thesrik23
    @Thesrik23 6 ปีที่แล้ว +14

    Awesome! You deserve more than 1 million subscribers.
    Hope that you'll have 1 million subscribers very soon.

    • @thedumbfounds767
      @thedumbfounds767  6 ปีที่แล้ว +3

      Thank you for your support Srikant, let's go for it!

  • @YaredFlores
    @YaredFlores 5 ปีที่แล้ว +4

    Very good tutorial, one of the best I have seen in ages! Congrats. Keep up the great work!

    • @thedumbfounds767
      @thedumbfounds767  5 ปีที่แล้ว +2

      Thanks Yared, I appreciate the awesome feedback!

  • @fahdalharbi8191
    @fahdalharbi8191 2 ปีที่แล้ว +1

    It's super usefull, simple and full of info

  • @hueguy
    @hueguy 3 ปีที่แล้ว +1

    Wow that looks really easy. Thank you for showing us !

  • @gabrieludoudo2718
    @gabrieludoudo2718 5 ปีที่แล้ว +2

    I love you Sir. You deserve more than 1 million subscribers.

  • @lookback6314
    @lookback6314 4 ปีที่แล้ว +1

    Thanks

  • @nicholassmith6412
    @nicholassmith6412 3 ปีที่แล้ว +1

    Useful, thanks

  • @unboxingmind
    @unboxingmind 4 ปีที่แล้ว +1

    Thank you.

  • @RahulSharma-ox6se
    @RahulSharma-ox6se 4 ปีที่แล้ว +1

    Thank you so much for this video!!!!

  • @premalparekh3517
    @premalparekh3517 4 ปีที่แล้ว +1

    very helpful thanks sir

  • @user-yk4zs7bd6n
    @user-yk4zs7bd6n 4 ปีที่แล้ว +1

    thanks a lot!

  • @GidzPaul
    @GidzPaul 3 ปีที่แล้ว +1

    Good tutorial

  • @arunh3
    @arunh3 4 ปีที่แล้ว +1

    Nice...So fast, but touches everything

  • @zypps3531
    @zypps3531 4 ปีที่แล้ว +1

    Awesome. Thanks.

  • @jixinliang5988
    @jixinliang5988 6 ปีที่แล้ว +3

    Awesome tutorial! Really enjoyed watching it!

  • @rameenhousseini6881
    @rameenhousseini6881 ปีที่แล้ว +1

    What kind of keyboard were you using? It sounds amazing

  • @user-tt9ni4vo1m
    @user-tt9ni4vo1m 4 ปีที่แล้ว +1

    Thank you, I am looking for this.

  • @khaoulawissalehariki2433
    @khaoulawissalehariki2433 4 ปีที่แล้ว +1

    thank you for this tutorial

  • @rangabharath4253
    @rangabharath4253 5 ปีที่แล้ว +2

    Awesome. Thank you so much

  • @quantumquantastic648
    @quantumquantastic648 4 ปีที่แล้ว +1

    wow its amazing

  • @gfxChris
    @gfxChris 5 ปีที่แล้ว +2

    You can fix the admin.py HttpResponseRedirect to ("../../"), which of course depends on the custom url path('fontsize//') in this case, go 2 directories back
    Without this, "Snipped with ID "fontsize" doesn't exist. Perhaps it was deleted?" will appear as yellog warning and the redirect happens to localhost:8000/admin, because it tried to access the page "/fontsize" before the ""

    • @robcollins6807
      @robcollins6807 4 ปีที่แล้ว

      Thanks - that was bugging me :)

  • @BabyFace4Lyfe
    @BabyFace4Lyfe 4 ปีที่แล้ว +1

    I know this video is 2 years old but which version of django were you using and is this tutorial update to date with the current version of django?

  • @andrewminhnguyen9446
    @andrewminhnguyen9446 5 ปีที่แล้ว +1

    Thanks for this! Very helpful!

  • @unboxingmind
    @unboxingmind 4 ปีที่แล้ว +1

    Thank you 😀😊😀😀😀😀😊😀😊😀😊😀😀😀 #unboxingmind

  • @IshanDasSharma
    @IshanDasSharma 6 ปีที่แล้ว +2

    Amazing!

  • @kaumsatria7981
    @kaumsatria7981 4 ปีที่แล้ว +1

    will you make video how to customize admin panel in django ? how to change it like WP admin panel

  • @VeLawrence
    @VeLawrence 4 ปีที่แล้ว +1

    Hi, nice video, not sure if you're going to see this message, but is there a way in which I can add for example a rad button to all records of a given model to mark them as primary (primary would be a field of the model) so when I click a record's rad button then the flag for it is set to true and all others are set to false? The rad button would have to appear in every record of the model

  • @samuelchege5024
    @samuelchege5024 5 ปีที่แล้ว +1

    thanx man

  • @patrickduhirwenzivugira4729
    @patrickduhirwenzivugira4729 4 ปีที่แล้ว +1

    Thank you for the video. How can you edit the admin login page? It would like to change the 'Django administration' text

  • @ViralMishra
    @ViralMishra 5 ปีที่แล้ว +1

    very nice sir

  • @josephdisraeliomenda2473
    @josephdisraeliomenda2473 5 ปีที่แล้ว +4

    So I'm getting the Django 'No module named 'suit.apps' error
    Your videos are really educational, thank you
    But can you please help with the above?

  • @aymaramono2196
    @aymaramono2196 6 ปีที่แล้ว +2

    it's very great. thank's

  • @nishantbhavsar6785
    @nishantbhavsar6785 5 ปีที่แล้ว +1

    Great tutorial sir. Would love to see your tutorials based on data visualization in Django using d3 or chart.js

    • @thedumbfounds767
      @thedumbfounds767  5 ปีที่แล้ว +2

      d3 and chart.js are both on the frontend, so you just need a way to make the frontend and backend talk with each other, just like you would with any other backend framework. Thanks for the suggestion! I'll consider doing something about that in the future.

    • @nishantbhavsar6785
      @nishantbhavsar6785 5 ปีที่แล้ว +1

      @@thedumbfounds767 thank you sir 😊

    • @thedumbfounds767
      @thedumbfounds767  5 ปีที่แล้ว +1

      @@nishantbhavsar6785 you're welcome! If you have any other requests, let me know. I'm always looking for suggestions ;)

  • @christiannyembo5740
    @christiannyembo5740 4 ปีที่แล้ว +1

    How can I redirect the user to the website after saving the form instead of redirecting then to the default admin section? I will really appreciate if someone could help.

  • @dantothomas7479
    @dantothomas7479 ปีที่แล้ว

    There is no suit.apps in suit package. How to do the import.

  • @kaylagordon8567
    @kaylagordon8567 5 ปีที่แล้ว +1

    If possible, I'd like to make a video request. Do you have any experience with a multiple page form? For example, the Form Wizard tool with Django? Would you be interested in making a tutorial for that where the form data gets passed in to the back end?
    You're making great tutorials! They're brilliant!

    • @thedumbfounds767
      @thedumbfounds767  5 ปีที่แล้ว +2

      Thanks Kayla, I don't have experience with it, yet. But it's a great video idea! Thanks.

  • @gratefulNow.
    @gratefulNow. 4 ปีที่แล้ว +1

    Thanks a lot for this awesome tutorial. By the way, can we add a search function to the Django admin?

    • @storiesfromincredibleindia
      @storiesfromincredibleindia 4 ปีที่แล้ว +1

      Hi, yes you defintely can, you just need to add search_fields attribute in Custom admin class that you create. Any field you mention in search_fields attribute can be used to search on list display on Django Admin

    • @gratefulNow.
      @gratefulNow. 4 ปีที่แล้ว

      @@storiesfromincredibleindia Thanks so much. I actually did it. Now I am looking for ways to let it be done at admin interface, not in code. Can you give me advice on that?

    • @darshandhabale143
      @darshandhabale143 3 ปีที่แล้ว

      @@gratefulNow. what do you mean?

  • @GunturBudiHerwanto
    @GunturBudiHerwanto 5 ปีที่แล้ว +1

    Subscribed!

  • @andrewsmichael416
    @andrewsmichael416 3 ปีที่แล้ว +1

    Hello Sir thank you for the tutorial
    please I have a question though it's beyond the scope of this tutorial
    I have a django app deployed on namecheap shared hosting and throws up and error such as:
    Request Method: POST
    Request URL: myworldgist.com/admin/blog/post/add/
    Raised by: django.contrib.admin.options.add_view
    And everything works well in development
    I have pillow installed and my urls config is ok according to the docs.
    Please any help base on how I could bypass this error will be highly appreciated

  • @sonalisingh4676
    @sonalisingh4676 5 ปีที่แล้ว +1

    When I m registering SnippetAdmin class in admin.py it's showing an error -
    For model in model_or_iterable:
    TypeError : 'MediaDefiningClass' object is not iterable...plz help

  • @delllatitude299
    @delllatitude299 5 ปีที่แล้ว +1

    you got a subscriber ;)

  • @mohamedsaif1928
    @mohamedsaif1928 6 ปีที่แล้ว

    GREAAAAAAAT !

  • @kenjohnsiosan9707
    @kenjohnsiosan9707 5 ปีที่แล้ว +1

    cool 😃

  • @wallawalla4405
    @wallawalla4405 5 ปีที่แล้ว

    how to add custom button or action in django admin panel to view single blog or template ?

  • @fsadykov
    @fsadykov 4 ปีที่แล้ว

    I just follow your video and can't find where did you mention that you will do api call to /admin/fontsize/int . I created my form its doing post method to /admin/ my code is not working. Where did you mention that?

  • @muhammadsultanularafin8846
    @muhammadsultanularafin8846 4 ปีที่แล้ว

    The default update option goes away when the list_display method is used in django admin. Any solution for that? Cheers!

  • @yangjack8695
    @yangjack8695 2 ปีที่แล้ว

    i want to add a button in admin's list_display, but ....

  • @rohitd1902
    @rohitd1902 4 ปีที่แล้ว

    can we add custom field through admin panel?

  • @dinonppa1
    @dinonppa1 6 ปีที่แล้ว +1

    Could you make a video about how to change the domain name of a local server. For example.. Say I want someone on the server to type in example.com:8000 and it lead to the django site. How would I go about doing that? I've found some tutorials, but none of them seem to work in django 2.0..

    • @thedumbfounds767
      @thedumbfounds767  6 ปีที่แล้ว +1

      Thanks for the suggestion! I'll do a video on that if I can make it work. Which tutorial have you found that didn't work?

    • @dinonppa1
      @dinonppa1 6 ปีที่แล้ว

      Awesome man! That would be amazing if you can pull it off!

    • @thedumbfounds767
      @thedumbfounds767  6 ปีที่แล้ว

      If you're on windows, have you tried editing the hosts file? Although that would probably be a security vulnerability, as you typically don't want to enable the hosts file to be edited.

    • @dinonppa1
      @dinonppa1 6 ปีที่แล้ว

      The Dumbfounds I have tried that. It works, but you have to edit them on every computer on the network that would try and access that URL. But yes, technically that does work, just only for that one computer.
      I didn’t know if there was a way to be able to do it from the host computer so that every computer on the network could type in example.com:8000 and be able to access the site. It would be basically setting up Django as an intranet through the network

  • @Christy5001
    @Christy5001 3 ปีที่แล้ว

    sir where to find snippets

  • @wanderingtravellerAB99
    @wanderingtravellerAB99 5 ปีที่แล้ว

    Short question - how do you get it working in terminal so you don't have to type "python" at the beginning of every command - and is this related to the "lambda" symbol?

    • @thedumbfounds767
      @thedumbfounds767  5 ปีที่แล้ว +1

      I used Windows in this tutorial. Which OS are you currently on? That may be the difference.

    • @wanderingtravellerAB99
      @wanderingtravellerAB99 5 ปีที่แล้ว

      @@thedumbfounds767 Aha, ok, I'm in Mac OSX. Maybe Windows recognises the .py and automatically runs it with the python in your env.

  • @niteshrawat576
    @niteshrawat576 5 ปีที่แล้ว

    Hey man gr8 video! Can u pls help me out with moving the filter panel that appears on the right side of the page towards the top of the page? I really want it to display on the top.
    Thanks in advance , God bless ya! :)

    • @thedumbfounds767
      @thedumbfounds767  5 ปีที่แล้ว +2

      Thanks! Haven't ever done that. Take a look at what makes the filter stick to the right (e.g. floats) and remove them.

    • @niteshrawat576
      @niteshrawat576 5 ปีที่แล้ว

      @@thedumbfounds767 hey man thanks for replying, I am trying it from a week now , no success. If you get time , pls have a look. :)

    • @thedumbfounds767
      @thedumbfounds767  5 ปีที่แล้ว +1

      @@niteshrawat576 I think it's best if you ask on StackOverflow. That way, many more people can respond! :)

  • @kenjohnsiosan9707
    @kenjohnsiosan9707 5 ปีที่แล้ว +1

    Hi sir im currently a PHP programmer and wanted to get a job as python-django programmer, any tips please 😊 thanks..

    • @thedumbfounds767
      @thedumbfounds767  5 ปีที่แล้ว +2

      I don't think there's much difference between getting one doing PHP and getting one using python/Django. Start looking, appliying and have some good projects ready you can showcase.

    • @kenjohnsiosan9707
      @kenjohnsiosan9707 5 ปีที่แล้ว +1

      @@thedumbfounds767 appreciate it a lot sir. 😁

  • @raheelize
    @raheelize 3 ปีที่แล้ว

    im getting error that, "'ModuleNotFoundError: No module named 'suit.apps'" --help

    • @CoopPlaysYoutuber
      @CoopPlaysYoutuber 3 ปีที่แล้ว

      do the following : pip uninstall django-suit
      pip install github.com/darklow/django-suit/tarball/v2

  • @himaljungoli1046
    @himaljungoli1046 4 ปีที่แล้ว

    sir i have this error how can i solve such error
    This site can’t be reachedlocalhost refused to connect.
    Try:
    Checking the connection
    Checking the proxy and the firewall
    ERR_CONNECTION_REFUSED

  • @frankwu3516
    @frankwu3516 5 ปีที่แล้ว +1

    The keyboard sound is so sexy! What is the model of it?

    • @thedumbfounds767
      @thedumbfounds767  5 ปีที่แล้ว

      It's a titanwolf! I think I'll get a new one, though, this one has caused me problems twice already...

  • @khawajaosama
    @khawajaosama 5 ปีที่แล้ว

    Customization is not working here

  • @maliknauman7873
    @maliknauman7873 4 ปีที่แล้ว

    i found this error .from suit.apps import DjangoSuitConfig
    ModuleNotFoundError: No module named 'suit.apps' . i have done the pip install django-suit and app setting myapp.apps.SuitConfig but this error is occuring. Help me

    • @shahedtalukder4219
      @shahedtalukder4219 4 ปีที่แล้ว

      i have got exact same problem. And i don't know why this going on

    • @anupthatal5253
      @anupthatal5253 4 ปีที่แล้ว

      Did you slove it I having same issue

  • @kushanjoshi1222
    @kushanjoshi1222 5 ปีที่แล้ว

    Is it possible to inject our js on Add button present under Snippet, if yes what steps i can follow, Please help!

    • @thedumbfounds767
      @thedumbfounds767  5 ปีที่แล้ว

      Don't really understand what you're after...

    • @kushanjoshi1222
      @kushanjoshi1222 5 ปีที่แล้ว

      @@thedumbfounds767 I want to change the form page from djanga admin(which shows the field and value from db), how can I do that

    • @thedumbfounds767
      @thedumbfounds767  5 ปีที่แล้ว +1

      @@kushanjoshi1222 Try overriding the object_form.html admin template. Not sure if that's the right one, but the name seems to fit. In the example of the video, the path should be /templates/admin/snippets/snippets_object_form.html. Let me know if that works!

    • @kushanjoshi1222
      @kushanjoshi1222 5 ปีที่แล้ว

      @@thedumbfounds767 Thanks for your direction, that might not be the apt name of the template, i want to alter but it gave me some html template with which i can fiddle around like change_form.html (i want to use a editor instead of that form, fetch the data so that i can perform some operation and show the output in particular format)

  • @chrisgomez7070
    @chrisgomez7070 5 ปีที่แล้ว

    Hi I'm wondering if I could make the django admin like a profile page with a picture and a description of you and I want to make a tracking thing like when you get a free trial and once the free trial is up it cuts you off until you signed up and can you put a progress bar in django admin Please let me know I've bee trying to figure how to do that but nobody answering thanks for your time

    • @thedumbfounds767
      @thedumbfounds767  5 ปีที่แล้ว +1

      The admin should really only be accessible to admins, never end users. If that's what you want your admins to see for every user, you can do that. You'd need to override the appropriate template(s).

    • @chrisgomez7070
      @chrisgomez7070 5 ปีที่แล้ว

      @@thedumbfounds767 Ok so I have to build one then in html or in python but I can't use the one that django has then. I want to build one like this for users blackrockdigital.github.io/startbootstrap-sb-admin/

    • @thedumbfounds767
      @thedumbfounds767  5 ปีที่แล้ว +1

      @@chrisgomez7070 yes, if it's for end users, DON'T use the built-in admin (it's meant for admins of the website itself). If you haven't done so yet, learn the basics of the web (frontend / backend), starting with the basics of the frontend, and take it from there.

    • @chrisgomez7070
      @chrisgomez7070 5 ปีที่แล้ว

      @@thedumbfounds767 Ok thanks

  • @F11550i
    @F11550i 4 ปีที่แล้ว

    13:31 for some reason the package apps is not in the installed suit from '> pip install djang-suit' ,,, i found it with this one : '> pip install github.com/darklow/django-suit/tarball/v2'

    • @F11550i
      @F11550i 4 ปีที่แล้ว

      anyway it always complain that 'module named 'suit' ' did not find...

    • @vaibhavshukla5673
      @vaibhavshukla5673 4 ปีที่แล้ว

      thanx a ton dude.....really helped me

    • @F11550i
      @F11550i 4 ปีที่แล้ว

      @@vaibhavshukla5673 No problem! :)

  • @intertainment1261
    @intertainment1261 5 ปีที่แล้ว

    Sir i have just started learning django. I do not get admin.site.register
    it says admin.site has no attribute register.
    it shows admin.register but i cant use it/
    YOUR HELP WILL BE HIGHLY APPRECIATED

    • @thedumbfounds767
      @thedumbfounds767  5 ปีที่แล้ว +1

      Could you share your admin.py file?

    • @intertainment1261
      @intertainment1261 5 ปีที่แล้ว

      from django.contrib import admin
      # Register your models here.
      from .models import Question,Choice
      @admin.register(Question)
      @admin.register(Choice)

    • @intertainment1261
      @intertainment1261 5 ปีที่แล้ว

      from django.contrib import admin
      # Register your models here.
      from .models import Question,Choice
      admin.site.register(Question)
      admin.site.register(Choice)
      at first i tried this. bus got an error.AFter that i used @admin but its of no use.

    • @thedumbfounds767
      @thedumbfounds767  5 ปีที่แล้ว +1

      @@intertainment1261 that's weird. Is your project on github? If yes, I'll try to replicate the error.

    • @intertainment1261
      @intertainment1261 5 ปีที่แล้ว

      I followed tutorials again. Got it right.
      May be i have missed one statement.Thanks a lot Sir!. You are a great teacher as well as great responser. YOur reply means a lot to me.
      Thanks once again.

  • @danielbodnar565
    @danielbodnar565 5 ปีที่แล้ว

    I cant get into the admin interface, becouse of 404 error

    • @darshandhabale143
      @darshandhabale143 3 ปีที่แล้ว

      you havent added the admin url to root url config. Check it

  • @skyblaze6687
    @skyblaze6687 5 ปีที่แล้ว +1

    ;/ good

  • @paristar3079
    @paristar3079 4 ปีที่แล้ว +1

    Please upload the full code in GitHub

  • @amohampofo
    @amohampofo 3 ปีที่แล้ว

    Not full customization

  • @headspacemeditation1562
    @headspacemeditation1562 5 ปีที่แล้ว +1

    Video summary:
    142 likes 0 dislike

  • @CoopPlaysYoutuber
    @CoopPlaysYoutuber 3 ปีที่แล้ว

    For thoso who are getting "Django 'No module named 'suit.apps' error" do the following :
    pip uninstall django-suit
    pip install github.com/darklow/django-suit/tarball/v2

  • @Techie-in-Cloud
    @Techie-in-Cloud 4 ปีที่แล้ว

    I keep getting Udemy ads for python and they disturb me. I will never use Udemy..

    • @thedumbfounds767
      @thedumbfounds767  4 ปีที่แล้ว

      "Python's where it's at. You can do almost anything with it. You know, you should check out this..."

  • @gallupgallup3348
    @gallupgallup3348 5 ปีที่แล้ว

    I understood nothing at all !

  • @malekogames2640
    @malekogames2640 5 ปีที่แล้ว +1

    Great , thank you a lot