Django Starter with Allauth and Htmx

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ก.ย. 2024

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

  • @christophermaile3842
    @christophermaile3842 6 หลายเดือนก่อน +1

    As always, I enjoy your great videos. Thanks for the great effort you always put into your work

  • @krzysiekkrzysiek9059
    @krzysiekkrzysiek9059 3 วันที่ผ่านมา +1

    One of the best tutorial i've ever seen on YT. You have a gift to teach man👌.
    1. But why in Django in models (11:53) we use class variable without `self`?
    2. 11:55 Why You use `{% if request.user.is_authenticated %}` and in another tutorial You use {% if user.is_authenticated %}`. What's the difference?

    • @ajudmeister
      @ajudmeister  3 วันที่ผ่านมา +1

      Thanks a lot!
      1. We define model classes without 'self' because these are class attributes and not instance attributes. 'Self' you would use when defining a method inside a class.
      2. they are the same, the difference is what object you are accessing. The request object is loaded to every template and we can access the user from there, or we can use the "user" variable, which is loaded also automatically to every template, and represents the logged-in user. That's why you should not name a variable "user", that would override this variable. But which version you want to use is up to you. Without "request." is simpler.

    • @krzysiekkrzysiek9059
      @krzysiekkrzysiek9059 3 วันที่ผ่านมา

      @@ajudmeister But we use instances of a class in a project not class itself. Is that correct?

  • @DisabledCookie
    @DisabledCookie 6 หลายเดือนก่อน

    Thank for this. Keep making htmx and django

  • @Sof_Hill
    @Sof_Hill 4 วันที่ผ่านมา

    Super great content mate. Thanks, and respect! :)

    • @ajudmeister
      @ajudmeister  3 วันที่ผ่านมา

      I appreciate the feedback. thanks!

  • @rexsybimatrimawahyu3292
    @rexsybimatrimawahyu3292 หลายเดือนก่อน

    Okay will try this tomorrow because it suck azz to deal with styling for django allauth (i have skill issue reading the doc maybe idk), and here you make things easy af

    • @ajudmeister
      @ajudmeister  หลายเดือนก่อน

      :) yea styling allauth can be a bit tricky as it comes with all his own templates.

  • @mzwakhe_louw
    @mzwakhe_louw 3 หลายเดือนก่อน

    Thank you so much for this. It helped me a lot with my project

  • @twiceasviewtiful
    @twiceasviewtiful 3 หลายเดือนก่อน

    Minor suggestions:
    1) Get rid of try except in profile avatar property. I changed it to this:
    @property
    def avatar(self):
    if self.image:
    return self.image.url
    return static("images/avatar.svg")
    2) Add hyphenation to frontend for profile info. If you type a very long word it is not split into several lines.

    • @ajudmeister
      @ajudmeister  3 หลายเดือนก่อน +1

      Awesome! Thanks a lot. Updated.

    • @twiceasviewtiful
      @twiceasviewtiful 3 หลายเดือนก่อน

      @@ajudmeister tried it but even with hyphens-auto long word in info is still not split and goes as far as it can go as if there was no limit to width.

    • @ajudmeister
      @ajudmeister  3 หลายเดือนก่อน

      @@twiceasviewtiful hmm, when i tried the word was split with hyphens-auto. maybe need to add break-words aswell

    • @twiceasviewtiful
      @twiceasviewtiful 3 หลายเดือนก่อน

      @@ajudmeister it seems that it has to follow some quirky rules to work properly, it works if you type "Kraftfahrzeug­haftpflichtversicherung Kraftfahrzeug­haftpflichtversicherung Kraftfahrzeug­haftpflichtversicherung Kraftfahrzeug­haftpflichtversicherung" but it doesn't if you try "Coooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooool".
      break-all did help, changed it to
      {{ profile.info|linebreaksbr }}

  • @amine63404
    @amine63404 6 หลายเดือนก่อน

    I like before I watch, I am sure this will be great.

    • @ajudmeister
      @ajudmeister  6 หลายเดือนก่อน

      Risky …

  • @la009895
    @la009895 5 หลายเดือนก่อน

    darn you shorts for converting me... and all hail the algorithm for putting this in front of me. I was looking for a simple oauth integration with django!

    • @ajudmeister
      @ajudmeister  5 หลายเดือนก่อน

      All hail the algorithm then! I am glad you find it useful.

    • @la009895
      @la009895 5 หลายเดือนก่อน

      @@ajudmeister so reading the docs, it would be pretty easy to add in google oauth to this, right?

    • @ajudmeister
      @ajudmeister  5 หลายเดือนก่อน +1

      @@la009895 yes it should be, but haven’t done it yet myself.

    • @la009895
      @la009895 5 หลายเดือนก่อน

      @@ajudmeister I smell a new short. How to add oauth to your project quickly!

    • @ajudmeister
      @ajudmeister  5 หลายเดือนก่อน

      @@la009895 lol, we will see. maybe it takes 2 seconds, no idea yet

  • @maharafhossen7100
    @maharafhossen7100 หลายเดือนก่อน

    Thanks Andreas,, Amazing Tutorial,, Take love

  • @FactsStories-w1m
    @FactsStories-w1m หลายเดือนก่อน +1

    He's the GOAT!!

  • @AmoahDevLabs
    @AmoahDevLabs 6 หลายเดือนก่อน

    This is really great. Thanks for sharing.

  • @user-bk1eb4xw4o
    @user-bk1eb4xw4o 6 หลายเดือนก่อน

    Wonderful new video, thank you for the video.

  • @user-ve4fu1gd7t
    @user-ve4fu1gd7t 5 หลายเดือนก่อน

    Thank you for the template, very helpful

  • @SpeedCodes-oc7ed
    @SpeedCodes-oc7ed 6 หลายเดือนก่อน

    your videos are awesome you make any django-backend developer to a frontend developer :)

    • @ajudmeister
      @ajudmeister  6 หลายเดือนก่อน

      haha, you bet!

  • @ItsEverythingElse
    @ItsEverythingElse 2 หลายเดือนก่อน

    Great tutorial. Inconsistent use of terms "log out" and "sign out" (easily fixed).

    • @ajudmeister
      @ajudmeister  2 หลายเดือนก่อน

      Thanks! Yea, it’s always tricky to be consistent 😅

  • @sahir3466
    @sahir3466 2 หลายเดือนก่อน

    awesome tutorial sir. Can you do a video on how to deploy in aws? 🤕[ django, tailwind, postgresql, ci/cd ] . There is no good video available online on the topic .Topic could be "How to deploy django website with CI/CD in aws". Please sir make a video. You have an incredible ability to simplify complex topics. 🧡🧡🧡

    • @ajudmeister
      @ajudmeister  2 หลายเดือนก่อน

      Hi, yes I might do that. I am planning a docker series aswell, could combine it there. Thanks for suggestion and feedback

  • @twiceasviewtiful
    @twiceasviewtiful 3 หลายเดือนก่อน

    Also noticed that there is a little inconsistency with User model/admin.py. When we login/signup email field is required but it is optional if you create object yourself or through django admin (it's not even present in the Add form).

    • @ajudmeister
      @ajudmeister  3 หลายเดือนก่อน

      Do you mean when the admin creates a new object it should tell him the email is required? How would you go about this?

    • @twiceasviewtiful
      @twiceasviewtiful 3 หลายเดือนก่อน

      ​@@ajudmeister I made custom user model inhereted from AbstractUser.
      from django.contrib.auth.models import AbstractUser
      class User(AbstractUser):
      email = models.EmailField(unique=True)
      USERNAME_FIELD = 'email'
      REQUIRED_FIELDS = ['username']
      Added custom model to settings:
      AUTH_USER_MODEL = "users.User"
      Added email to add userform in admin:
      from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
      @admin.register(User)
      class UserAdmin(BaseUserAdmin):
      add_fieldsets = (
      (
      None,
      {
      "classes": ("wide",),
      "fields": (
      "email",
      "username",
      "password1",
      "password2",
      ),
      },
      ),
      )
      And replaced everywhere
      from django.contrib.auth.models import User
      to
      from django.contrib.auth import get_user_model
      User = get_user_model()

  • @deez_dev
    @deez_dev 6 หลายเดือนก่อน

    I loved it, keep going

  • @adarsh6766
    @adarsh6766 10 ชั่วโมงที่ผ่านมา +1

    will you make a video on django social login with google and facebook

    • @ajudmeister
      @ajudmeister  10 ชั่วโมงที่ผ่านมา

      @@adarsh6766 yes, on the list

  • @tatemo_labs
    @tatemo_labs 3 หลายเดือนก่อน

    Awesome video! thank you!

  • @Dorso2009
    @Dorso2009 2 หลายเดือนก่อน

    Thanks for the video!!!

    • @ajudmeister
      @ajudmeister  2 หลายเดือนก่อน

      You are welcome :)

  • @FlectionPoint
    @FlectionPoint 5 หลายเดือนก่อน

    Thanks, this is great, but there may be a bug, or I missed a step. If you go to Login, then select "sign up" from the hyperlink after a new user is created they redirect to home rather than profile creation. To fix it update the login.html href --> href="{% url 'account_signup' %}?next={% url 'profile-onboarding' %}"

    • @ajudmeister
      @ajudmeister  5 หลายเดือนก่อน

      Thank you, well spotted! I made a copy of the login.html file from the allauth templates and added the "next" parameter. I also deleted the {% blocktrans %} tag, that was causing an issue there.
      Cheers!

  • @IqbalArain-io3du
    @IqbalArain-io3du 5 หลายเดือนก่อน

    Thank You. That was great great great ♥.
    Sir, Do you plan to teach multiple user types example: [teacher, admin, student, parent] ?
    Best Wishes and Good Luck

    • @ajudmeister
      @ajudmeister  5 หลายเดือนก่อน

      Thank you! I assume you are talking about different permission settings for different groups. I might integrate it in a future project, yes.

  • @twiceasviewtiful
    @twiceasviewtiful 3 หลายเดือนก่อน +1

    Encountered a problem with {% if user.emailaddress_set.first.verified %} in templates/users/profile_settings.html. Had to change first to last ({% if user.emailaddress_set.first.verified %} to show the correct status. Maybe some recent updates to Allauth changed ordering.
    UPD:
    Turned out it doesn's matter because there should be only one EmailAddress object. But somehow I had two (initial and changed). Tried to replicate it again but everything's working as intended.

    • @ajudmeister
      @ajudmeister  3 หลายเดือนก่อน

      Are you using allauth? With allauth a user could have more email addresses associated with the same user, thats why I am using .first because it gives me back a list, but should only have one object in it. If you got somehow two, maybe the save method didn't update the email but created a new object instead, then the last might be verified.

    • @twiceasviewtiful
      @twiceasviewtiful 3 หลายเดือนก่อน +1

      @@ajudmeister Yeah. Turned out I had two because I changed email once before writing post_save signal part that's why a new object was created.

  • @RevMirrane
    @RevMirrane 6 หลายเดือนก่อน

    thanks for the vid

  • @codernerd7076
    @codernerd7076 6 หลายเดือนก่อน

    Great video! Currently looking into how to use social login with management and connecting accounts, and 2FA with Authenticator apps but can't find anything on TH-cam :(

    • @ajudmeister
      @ajudmeister  6 หลายเดือนก่อน +2

      Thanks. Will put social login and 2FA authentication in the list. allauth has documentation for the different logins, but haven’t tried them out myself yet.

    • @codernerd7076
      @codernerd7076 6 หลายเดือนก่อน

      @ajudmeister thank you! 😊

    • @fernandtape9363
      @fernandtape9363 6 หลายเดือนก่อน +1

      Very nice, thanks. Can you plz add tailwind configuration with the django-tailwind package?

    • @ajudmeister
      @ajudmeister  5 หลายเดือนก่อน +1

      i will make another deep dive into tailwind when Tailwind v4 is out.

  • @SpeedCodes-oc7ed
    @SpeedCodes-oc7ed 6 หลายเดือนก่อน +1

    by the way, i see that you use alpineJS and hyperscript as well, my question is which of them both would you prefer and why?

    • @ajudmeister
      @ajudmeister  6 หลายเดือนก่อน +1

      i really like alpine because it's easy to use for many often used behaviours. hyperscript is still a bit obscure to me, if I need some custom javascript I might opt to use vanilla javascript instead if I had to choose.

  • @frameff9073
    @frameff9073 6 หลายเดือนก่อน

    Good thank

  • @HummingLaught
    @HummingLaught 3 หลายเดือนก่อน

    is this project use ORM? and i wonder if instead of using orm, can we use raw sql🤔

    • @ajudmeister
      @ajudmeister  3 หลายเดือนก่อน

      Yes, it is using Django’s ORM system, however you can write raw SQL queries aswell if you prefer.

  • @pacifist6271
    @pacifist6271 3 หลายเดือนก่อน

    Why can't you explain what are you writing? This is for beginners, so please explain how is this working

    • @ajudmeister
      @ajudmeister  3 หลายเดือนก่อน +3

      Hello, as I mentioned in the intro this video is a bit advanced and not for absolute beginners. You should check out my backend tutorial series if you are new to django as I explain the concept there in detail. All the best

  • @anouarben779
    @anouarben779 3 หลายเดือนก่อน +1

    would be very helpful if you could point out how can we load allauth with another language as I believe it supports multi language templates.

    • @ajudmeister
      @ajudmeister  3 หลายเดือนก่อน

      Django indeed supports multi language templates, however I have not worked with them yet, so I can only refer to the official Django documentation.

    • @anouarben779
      @anouarben779 3 หลายเดือนก่อน +1

      @@ajudmeister thanks Andreas I managed to get them working after a bit of back and forth.