Django Starter with Allauth and Htmx

Тәжірибелік нұсқаулар және стиль

In this tutorial we build a Django Starter project as a foundation for future tutorials, using the Allauth package for User authentication and Htmx to update the User email address.
Assets: github.com/andyjud/django-sta...
Full Code: github.com/andyjud/django-sta...
Live Site: awesomepixx.com
0:00 Demo
3:20 Django Setup
5:40 Homepage
11:05 Profile Pages
21:50 Allauth and Sign Up
30:25 Settings Page with Htmx
40:48 404 Page
Support me on:
Patreon: / andreasjud
Buy me a Coffee: www.buymeacoffee.com/andreasjud
Thank you.
Follow me on:
Twitter: / ajudmeister
Instagram: / ajudmeister
#django #htmx #deployment #allauth #python #pythonprogramming #selftaughtdeveloper #webdevelopment #webapp #stayathomedad

Пікірлер: 49

  • @christophermaile3842
    @christophermaile38423 ай бұрын

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

  • @DisabledCookie
    @DisabledCookie3 ай бұрын

    Thank for this. Keep making htmx and django

  • @AmoahDevLabs
    @AmoahDevLabs2 ай бұрын

    This is really great. Thanks for sharing.

  • @mzwakhe_louw
    @mzwakhe_louw18 күн бұрын

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

  • @user-ve4fu1gd7t
    @user-ve4fu1gd7t2 ай бұрын

    Thank you for the template, very helpful

  • @tatemo_labs
    @tatemo_labs21 күн бұрын

    Awesome video! thank you!

  • @user-bk1eb4xw4o
    @user-bk1eb4xw4o3 ай бұрын

    Wonderful new video, thank you for the video.

  • @deez_dev
    @deez_dev3 ай бұрын

    I loved it, keep going

  • @amine63404
    @amine634043 ай бұрын

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

  • @ajudmeister

    @ajudmeister

    3 ай бұрын

    Risky …

  • @RevMirrane
    @RevMirrane3 ай бұрын

    thanks for the vid

  • @twiceasviewtiful
    @twiceasviewtiful17 күн бұрын

    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

    17 күн бұрын

    Awesome! Thanks a lot. Updated.

  • @twiceasviewtiful

    @twiceasviewtiful

    16 күн бұрын

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

    16 күн бұрын

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

  • @twiceasviewtiful

    @twiceasviewtiful

    16 күн бұрын

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

  • @SpeedCodes-oc7ed
    @SpeedCodes-oc7ed3 ай бұрын

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

  • @ajudmeister

    @ajudmeister

    3 ай бұрын

    haha, you bet!

  • @twiceasviewtiful
    @twiceasviewtiful17 күн бұрын

    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

    17 күн бұрын

    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

    16 күн бұрын

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

  • @frameff9073
    @frameff90733 ай бұрын

    Good thank

  • @la009895
    @la0098952 ай бұрын

    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

    2 ай бұрын

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

  • @la009895

    @la009895

    2 ай бұрын

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

  • @ajudmeister

    @ajudmeister

    2 ай бұрын

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

  • @la009895

    @la009895

    2 ай бұрын

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

  • @ajudmeister

    @ajudmeister

    2 ай бұрын

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

  • @IqbalArain-io3du
    @IqbalArain-io3du2 ай бұрын

    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

    2 ай бұрын

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

  • @SpeedCodes-oc7ed
    @SpeedCodes-oc7ed3 ай бұрын

    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

    3 ай бұрын

    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.

  • @codernerd7076
    @codernerd70763 ай бұрын

    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 KZread :(

  • @ajudmeister

    @ajudmeister

    3 ай бұрын

    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

    3 ай бұрын

    @ajudmeister thank you! 😊

  • @fernandtape9363

    @fernandtape9363

    3 ай бұрын

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

  • @ajudmeister

    @ajudmeister

    2 ай бұрын

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

  • @FlectionPoint
    @FlectionPoint2 ай бұрын

    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

    2 ай бұрын

    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!

  • @twiceasviewtiful
    @twiceasviewtiful18 күн бұрын

    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

    18 күн бұрын

    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

    17 күн бұрын

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

  • @HummingLaught
    @HummingLaught10 күн бұрын

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

  • @ajudmeister

    @ajudmeister

    10 күн бұрын

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

  • @pacifist6271
    @pacifist62714 күн бұрын

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

  • @ajudmeister

    @ajudmeister

    4 күн бұрын

    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
    @anouarben77913 күн бұрын

    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

    8 күн бұрын

    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

    8 күн бұрын

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

Келесі