49 comments

  1. This doesnt work for me and I think I found the cause in a forum :
     This is not the right use for a ModelForm. They are for creating and
    editing items in the database; the error message is because you have
    used this form as if you were creating a new user, and it's preventing
    you from doing that because the user with that username already exists.
     Use a standard form instead. Or even better, use the LoginForm from
    django.contrib.auth.forms; the advantage of that is that it calls
    authenticate for you as part of the validation process, so that login
    errors will be included in the form errors (rather than completely
    ignored, as your code does).

  2. I learned to do the cleaning and sometimes the user check (against the db) in the forms as methods of the form. Seems like your way is cleaner (less steps), and less code. Is this the standard for Django? or just a mater of preference? Lastly, is the method I use best practice or even recommended?

  3. haven't moved past this video, but thanks a lot, you taught me a great deal of things with your video.

    If you can, when you get time, can you make some videos on algorithms and they're implementation, such as the types of sorting and searching

  4. Hello! Thank you so much for this useful tutorial. I watched all of these videos and wanted to complete the other bits myself. But I have a question. I have been searching for the answer but couldn't find anything useful. I am trying to implement the search option in my project. I had a look at your code on GitHub. But you used function based views instead of class based view. How do i do this search using class based views? I am new in Django so my apologies if this is too basic.

  5. Hey Bucky, was checking out your Vibber application, a fine piece of work mate. But I need to clarify something which I think is a problem with the URLs.

    When just going on localhost:8000 after running server, it's showing a login page, cool. Next when I log in the URL is <http://localhost:8000/music/login_user/>, shouldn't it get a redirection to <localhost/music/ > automatically. that's where the albums are. But it's only getting redirected to the URL after clicking on the Album tab in the Navbar.

    My question is how to redirect automatically to localhost/music and then render the HTML Template?

    Thanks for the tutorial series, learnt a lot.

  6. tried doing this to get a separate log in page:

    class LoginFormView(View):
    form_class = LoginForm
    template_name = 'accounts/login.html'

    def get(self, request):
    form = self.form_class(None)
    return render(request, self.template_name, {'form':form})

    def post(self, request):
    form = self.form_class(request.POST)
    if form.is_valid():
    user = form.save(commit=False)
    username = form.cleaned_data['username']
    password = form.cleaned_data['password']
    user = authenticate(username=username, password=password)

    if user is not None:
    if user.is_active:
    login(request, user)
    return redirect('post_list')
    else:
    return HttpResponse('Ghanta User active')

    else:
    return HttpResponse('Ghanta user existence')
    else:
    return HttpResponse('Ghanta valid form')

    I get Ghanta valid form 🙁

  7. After filling up the whole form of registration when I press the submit button it's showing 'POST' is not defined.'POST' is an argument in the function post within the class UserFormView.

  8. I made 3 accounts. All the albums in all 3 accounts are the same. I add to a album to 1 account they get added to all three accounts. Same with delete. How do you resolve this. Did you guys face the same issue?

  9. For Logout button to work, do the following:

    —–> base.html
    <li class="">
    <a href={% url 'music:logout' %}>
    <span class="glyphicon glyphicon-off" aria-hidden="true"></span>&nbsp; Logout
    </a>
    </li>

    —-> urls.py
    from django.contrib.auth.views import logout

    # /logout/
    url(r'^logout/$', views.logout_view , name='logout'),

    —-> views.py
    from django.contrib.auth import logout

    def logout_view(request):
    logout(request)
    return redirect('music:index')

  10. Django tutorial 36 User Authentication and Login
    apps used in this tutorial

    musictemplatesmusicregistration_form.html
    musictemplatesmusicalbum_form.html

    musicforms .py
    musicurls .py
    musicviews .py

  11. Hey thenewboston this project is not complete plz, many things are still pending kindly complete the project, Waiting for your tutorials 🙂

  12. о боже, я впервые вижу канал с лям подписонами на тематику программирование

Comments are closed.