Django Admin Tutorial - Full Customization (2018)

Поділитися
Вставка
  • Опубліковано 14 жов 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 UA-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

  • @rameenhousseini6881
    @rameenhousseini6881 2 роки тому +1

    What kind of keyboard were you using? It sounds amazing

  • @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!

  • @gabrieludoudo2718
    @gabrieludoudo2718 5 років тому +2

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

  • @hueguy
    @hueguy 3 роки тому +1

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

  • @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?

  • @fahdalharbi8191
    @fahdalharbi8191 2 роки тому +1

    It's super usefull, simple and full of info

  • @nicholassmith6412
    @nicholassmith6412 3 роки тому +1

    Useful, thanks

  • @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 ""

  • @GidzPaul
    @GidzPaul 3 роки тому +1

    Good tutorial

  • @arunh3
    @arunh3 4 роки тому +1

    Nice...So fast, but touches everything

  • @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

  • @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

  • @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?

  • @RahulSharma-ox6se
    @RahulSharma-ox6se 4 роки тому +1

    Thank you so much for this video!!!!

  • @kaumsatria7981
    @kaumsatria7981 5 років тому +1

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

  • @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.

  • @premalparekh3517
    @premalparekh3517 4 роки тому +1

    very helpful thanks sir

  • @jixinliang5988
    @jixinliang5988 6 років тому +3

    Awesome tutorial! Really enjoyed watching it!

  • @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?

  • @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

  • @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.

  • @unboxingmind
    @unboxingmind 4 роки тому +1

    Thank you.

  • @zypps3531
    @zypps3531 4 роки тому +1

    Awesome. Thanks.

  • @李沅勳-e4c
    @李沅勳-e4c 4 роки тому +1

    thanks a lot!

  • @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?

  • @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 ;)

  • @lookback6314
    @lookback6314 4 роки тому +1

    Thanks

  • @순위
    @순위 4 роки тому +1

    Thank you, I am looking for this.

  • @dantothomas7479
    @dantothomas7479 Рік тому

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

  • @khaoulawissalehariki2433
    @khaoulawissalehariki2433 4 роки тому +1

    thank you for this tutorial

  • @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

  • @muhammadsultanularafin8846
    @muhammadsultanularafin8846 5 років тому

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

  • @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

  • @quantumquantastic648
    @quantumquantastic648 4 роки тому +1

    wow its amazing

  • @niteshrawat576
    @niteshrawat576 6 років тому

    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  6 років тому +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 6 років тому

      @@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  6 років тому +1

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

  • @wallawalla4405
    @wallawalla4405 5 років тому

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

  • @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.

  • @andrewminhnguyen9446
    @andrewminhnguyen9446 6 років тому +1

    Thanks for this! Very helpful!

  • @rohitd1902
    @rohitd1902 4 роки тому

    can we add custom field through admin panel?

  • @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. 😁

  • @ViralMishra
    @ViralMishra 5 років тому +1

    very nice sir

  • @kushanjoshi1222
    @kushanjoshi1222 6 років тому

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

    • @thedumbfounds767
      @thedumbfounds767  6 років тому

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

    • @kushanjoshi1222
      @kushanjoshi1222 6 років тому

      @@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  6 років тому +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 6 років тому

      @@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)

  • @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

  • @powerwheels2025
    @powerwheels2025 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).

    • @powerwheels2025
      @powerwheels2025 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

      @@powerwheels2025 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.

    • @powerwheels2025
      @powerwheels2025 5 років тому

      @@thedumbfounds767 Ok thanks

  • @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...

  • @raheelize
    @raheelize 4 роки тому

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

    • @Andandonafronteira
      @Andandonafronteira 3 роки тому

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

  • @malekogames2640
    @malekogames2640 6 років тому +1

    Great , thank you a lot

  • @Christy5001
    @Christy5001 3 роки тому

    sir where to find snippets

  • @IshanDasSharma
    @IshanDasSharma 6 років тому +2

    Amazing!

  • @maliknauman7873
    @maliknauman7873 5 років тому

    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 5 років тому

      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

  • @delllatitude299
    @delllatitude299 5 років тому +1

    you got a subscriber ;)

  • @aymaramono2196
    @aymaramono2196 6 років тому +2

    it's very great. thank's

  • @samuelchege5024
    @samuelchege5024 5 років тому +1

    thanx man

  • @unboxingmind
    @unboxingmind 4 роки тому +1

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

  • @yangjack8695
    @yangjack8695 2 роки тому

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

  • @thunder-v8h
    @thunder-v8h 6 років тому +1

    Subscribed!

  • @intertainment1261
    @intertainment1261 6 років тому

    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  6 років тому +1

      Could you share your admin.py file?

    • @intertainment1261
      @intertainment1261 6 років тому

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

    • @intertainment1261
      @intertainment1261 6 років тому

      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  6 років тому +1

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

    • @intertainment1261
      @intertainment1261 6 років тому

      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.

  • @paristar3079
    @paristar3079 5 років тому +1

    Please upload the full code in GitHub

  • @N63B44TÜ
    @N63B44TÜ 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'

    • @N63B44TÜ
      @N63B44TÜ 4 роки тому

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

    • @vaibhavshukla5673
      @vaibhavshukla5673 4 роки тому

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

    • @N63B44TÜ
      @N63B44TÜ 4 роки тому

      @@vaibhavshukla5673 No problem! :)

  • @khawajaosama
    @khawajaosama 5 років тому

    Customization is not working here

  • @mohamedsaif1928
    @mohamedsaif1928 6 років тому

    GREAAAAAAAT !

  • @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

  • @kenjohnsiosan9707
    @kenjohnsiosan9707 6 років тому +1

    cool 😃

  • @headspacemeditation1562
    @headspacemeditation1562 5 років тому +1

    Video summary:
    142 likes 0 dislike

  • @Andandonafronteira
    @Andandonafronteira 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-time
    @Techie-time 5 років тому

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

    • @thedumbfounds767
      @thedumbfounds767  5 років тому

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

  • @skyblaze6687
    @skyblaze6687 5 років тому +1

    ;/ good

  • @amohampofo
    @amohampofo 3 роки тому

    Not full customization

  • @gallupgallup3348
    @gallupgallup3348 5 років тому

    I understood nothing at all !

  • @rangabharath4253
    @rangabharath4253 5 років тому +2

    Awesome. Thank you so much