igorsimb / mp-monitor

Django app for scraping Wildberries
1 stars 0 forks source link

[Homepage] Different home page for authenticated vs unauthenticated user #64

Closed igorsimb closed 6 months ago

igorsimb commented 8 months ago

Unauthenticated: index Authenticated: item_list

igorsimb commented 8 months ago

Can be done using something like this:

def index(request: HttpRequest) -> HttpResponse:
    """The entry point for the website."""
    template_name = "core/index_unauthenticated.html"
    if request.user.is_authenticated:
        template_name = "core/index.html"
    return render(request, template_name, context)

Source: https://github.com/mblayman/journal/blob/main/journal/core/views.py