You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from .forms import DweetForm
from .models import Dweet, Profile
@login_required(login_url='/admin/')
def dashboard(request):
form = DweetForm(request.POST or None)
In this way automatically if the user is not logged get redirect to the admin for login, maybe there are better ways as it is just a prototype, but a prototype shouldn't crash.
The text was updated successfully, but these errors were encountered:
Mte90
changed the title
Dtwitter crash if user not logged
[Patch] Dtwitter crash if user not logged
Oct 6, 2023
ℹ️ Please note that the best way to get support for Real Python courses & articles is to join one of our weekly Office Hours calls or in the RP Community Slack.
You can report issues and problems here, but we typically won't be able to provide 1:1 support outside the channels listed above.
Describe the bug
If you get from part-4 the source final and load in the browser you get:
Fix
The first lines of the file https://github.com/realpython/materials/blob/master/dwitter-part-4/source_code_final/dwitter/views.py#L7 should be:
In this way automatically if the user is not logged get redirect to the admin for login, maybe there are better ways as it is just a prototype, but a prototype shouldn't crash.
The text was updated successfully, but these errors were encountered: