Customizing Django Admin (search and filtering)

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

Комментарии • 51

  • @amirhosseinnashvi2125
    @amirhosseinnashvi2125 4 года назад +4

    hey you are awesome!!!
    i almost spent a week learning django but i wasn't able to find such a good tutorial for it
    thank you so muuch!!!

  • @biswanathdeyrosted7702
    @biswanathdeyrosted7702 3 года назад +1

    Really appreciate the way you explain. Love to see some django rest with reactjs🥰🥰

  • @mohcench1903
    @mohcench1903 4 года назад +2

    I like your honesty

  • @davidvenegas2708
    @davidvenegas2708 3 года назад

    Excellent explanation

  • @dr.osesunday1096
    @dr.osesunday1096 Год назад

    Your work is perfect, but please i have an issue, after following your intructions to 3minuites 35 seconds and i try to run the project it shows me this error: NameError: name 'AccountAdmin' is not defined. please how do i fix this issue

  • @optimisticenigma283
    @optimisticenigma283 3 года назад

    while fiddling around with def __str__(self): method, I can't seem to get the username to display, I've looked over the video a lot, but can only display the email. I did the same as Mitch did (return self.email + ", " + self.username)

  • @naineshrathod2392
    @naineshrathod2392 3 года назад

    I did exactly same as what you did, but I cannot email field in the form while creating a user manually from the admin panel, why is that ?

  • @amirrezamousavi5139
    @amirrezamousavi5139 2 года назад

    Great job, thanks

  • @arduinobkdn883
    @arduinobkdn883 3 года назад

    when i get all accounts i get an error that Account doesn have objects atribute

  • @piyush6631
    @piyush6631 4 года назад +3

    When I'm customizing the user admin and trying to add a user using my website admin, it won't show me the email field. I've done the exact same steps that you did. I'm stuck on this problem for two days now, tried clearing migrations, made sure the USERNAME_FIELD is set to 'email' and still don't know what to do. It's driving me crazy

    • @jniyomufasha
      @jniyomufasha 4 года назад +1

      Django documentations says:
      docs.djangoproject.com/en/3.1/topics/auth/customizing/#custom-users-and-the-built-in-auth-forms
      Some built-in forms such as AuthenticationForm, SetPasswordForm, PasswordChangeForm, AdminPasswordChangeForm are compatible with any subclass of AbstractBaseUser, whereas others, including UserCreationForm, UserChangeForm are tied to built-in User model and need to be rewritten or extended to work with a custom user model.
      The documentation gives an example on how to rewrite the UserCreationForm and UserChangeForm in the UserAdmin.
      docs.djangoproject.com/en/3.1/topics/auth/customizing/#a-full-example

    • @sathishkumar2852
      @sathishkumar2852 4 года назад

      @@jniyomufasha thanks man

  • @rajshreesome3275
    @rajshreesome3275 3 года назад

    @Mitch how can we do the search based on the property of the Model class

    • @shaikirrted2767
      @shaikirrted2767 3 года назад

      django.core.exceptions.FieldError: Unknown field(s) (username) specified for Account. Check fields/fieldsets/exclude attributes of class AccountAdmin.
      help

  • @CryptoCodeZone
    @CryptoCodeZone 5 лет назад

    Okay - maybe django - maybe another library updated but now I get
    RuntimeError: Model class src.account.models.Account doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
    I spect some time to try and figure it out but cant find answer
    I even copied the GitHub code to make sure I have no typo's
    Can you guide me please

  • @univers8764
    @univers8764 4 года назад +1

    Hi, i did everything like you did except username I used user_name instead all worked perfect till here.
    but when I added admin.site.register(Account,AccountAdmin) i get this error
    class 'account.admin.AccountAdmin'>: (admin.E033) The value of 'ordering[0]' refers to 'username', which is not an attribute of 'account.Account'.
    i also copied the source code (changed only username to user_name) and received the same error
    if i delete AccountAdmin and register like this admin.site.register(Account) it works like up to previous chapter
    can you help?
    Thanks

    • @moonshrine6703
      @moonshrine6703 4 года назад +4

      Yeah, I also had this problem but I found the solution for it. Add this line of code in admin.py "ordering = ()" same as "list_filter = ()". That should solve the error.

    • @ramzes5710
      @ramzes5710 4 года назад

      @@moonshrine6703 ohhh, dude thank you so much )

  • @KevinTempelx
    @KevinTempelx 4 года назад

    Thanks!

  • @PepeTostado
    @PepeTostado 3 года назад

    The password is not hidden for me, what do i do?

  • @vensonestrope4534
    @vensonestrope4534 5 лет назад +1

    FieldError at /admin/account/account/2/change/
    Unknown field(s) (user_permissions, first_name, last_name, groups) specified for Account. Check fields/fieldsets/exclude attributes of class AccountAdmin.

    • @CosmicNomadis22
      @CosmicNomadis22 4 года назад

      Me too. Have you figured out the issue yet?

    • @Rajeshkushi
      @Rajeshkushi 4 года назад +2

      @@CosmicNomadis22 add fieldsets = () in class AccountAdmin in admin.py file. u wont get that error

    • @CosmicNomadis22
      @CosmicNomadis22 4 года назад

      @@Rajeshkushi thanks mate!👍🏾

    • @shaikirrted2767
      @shaikirrted2767 3 года назад

      @@Rajeshkushi loveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee u man...My life stuck here for 1 hour you saved me...thank you

  • @hatawjalalmohammad3395
    @hatawjalalmohammad3395 4 года назад

    Hi, how create useradmin?

  • @hariniprakash258
    @hariniprakash258 4 года назад +5

    Can someone help? I followed the code exactly as I do not have a basis on classes,objects and instances in python. What do I change?
    AttributeError at /
    type object 'Account' has no attribute 'objects'
    Request Method: GET
    Request URL: 127.0.0.1:8000/
    Django Version: 3.0.7
    Exception Type: AttributeError
    Exception Value:
    type object 'Account' has no attribute 'objects'
    Exception Location: C:\Users\Surface\Desktop\ECOMMERCE\src\personal\views.py in home_screen_view, line 6
    Python Executable: C:\Users\Surface\Desktop\ECOMMERCE\src\venv\Scripts\python.exe

    • @fruitlover7073
      @fruitlover7073 4 года назад +3

      it's saying you don't have objects in Account. because we are using a custom account class we had to put objects = MyAccountManager()
      . make sure you spelled objects right.

    • @hariniprakash258
      @hariniprakash258 4 года назад

      @@fruitlover7073 OMG wow. Was stuck for a long time on that. Alright thankyou so much. Appreciate the help

  • @jeckosayo3764
    @jeckosayo3764 3 года назад

    Still the password is not hashing :(

  • @savin1999
    @savin1999 5 лет назад +1

    codinginflow was searched xD

    • @codingwithmitch
      @codingwithmitch  5 лет назад +1

      duh. Where else am I gunna learn android stuff?

    • @savin1999
      @savin1999 5 лет назад +2

      @@codingwithmitch that's true
      Both of you are quite good at teaching much better than what I get in my college xD

    • @codingwithmitch
      @codingwithmitch  5 лет назад

      @@savin1999 nice to hear that 😁.
      Want to do something for me?
      Leave a testimonial here: codingwithmitch.com/testimonials

    • @savin1999
      @savin1999 5 лет назад +1

      @@codingwithmitch hey i have left a testimonial !

    • @codingwithmitch
      @codingwithmitch  5 лет назад +1

      @@savin1999 thanks you the best

  • @gerardike415
    @gerardike415 3 года назад

    i love your videos. your awesome dude, but my only question is why are you using the views.py inside the personal folder to pass variables for the account app. Aren't they 2 separate apps ?, plus doesn't account already have its own views.py

    • @shaikirrted2767
      @shaikirrted2767 3 года назад

      django.core.exceptions.FieldError: Unknown field(s) (username) specified for Account. Check fields/fieldsets/exclude attributes of class AccountAdmin.
      help

  • @shaikirrted2767
    @shaikirrted2767 3 года назад

    Its APPEARS AFTER I CLICK ADD ACCOUNT ...how to resolve i dont understand.....help mitch
    django.core.exceptions.FieldError: Unknown field(s) (username) specified for Account. Check fields/fieldsets/exclude attributes of class AccountAdmin.