Skip to content

Commit

Permalink
Drobne zmiany w konfiguracji i widoku domyślnym aplikacji Django "Mał…
Browse files Browse the repository at this point in the history
…y Bar – Pizza"
  • Loading branch information
xinulsw committed Dec 27, 2016
1 parent aff50cd commit 00141c5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
11 changes: 5 additions & 6 deletions malybar/malybar/settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Django settings for malybar project.
Expand Down Expand Up @@ -124,8 +123,8 @@
STATIC_URL = '/static/'

# django-registration
REGISTRATION_OPEN = True # If True, users can register
ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window;
REGISTRATION_AUTO_LOGIN = True # If the user will be automatically logged in.
LOGIN_REDIRECT_URL = '/pizza/' # The page you want users to arrive at after they successful log in
LOGIN_URL = '/konta/login/' # The page users are directed to if they are not logged in,
REGISTRATION_OPEN = True # czy użytkownik może utworzyć konto
ACCOUNT_ACTIVATION_DAYS = 7 # czas na aktywację konta
REGISTRATION_AUTO_LOGIN = True # czy użytkownik zostanie automatycznie zalogowany
LOGIN_REDIRECT_URL = '/pizza/' # strona docelowa po zalogowaniu użytkownika
LOGIN_URL = '/konta/login/' # strona logowania
14 changes: 5 additions & 9 deletions malybar/pizza/templates/pizza/index.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
{% extends "pizza/base.html" %}
{% block title %}Mały Bar – Witamy{% endblock %}
{% block title %}Mały Bar{% endblock %}

{% block content_title %}
{% if user.is_authenticated %}
Witaj w aplikacji Pizza, {{ user.username | upper }}!
{% else %}
Witaj w aplikacji Pizza!
{% endif %}
{% endblock %}
{% block content_title %}Mały Bar{% endblock %}

{% block content %}
{% if not user.is_authenticated %}
<h2>{{ komunikat }}</h2>
<div class="btn-group">
<span><a href="{% url 'auth_login' %}" class="btn btn-primary btn-sm">Zaloguj się</a></span> lub
<span><a href="{% url 'registration_register' %}" class="btn btn-primary btn-sm">Załóż konto</a></span>
</div>
{% else %}
<h2>Operacje:</h2>
<h2>Witaj w aplikacji Pizza, {{ user.username | upper }}!</h2>
<h3>Operacje:</h3>
<div class="btn-group">
<span><a href="{% url 'pizza:dodaj' %}" class="btn btn-primary btn-sm">Dodaj pizzę</a></span>
<span><a href="{% url 'pizza:lista' %}" class="btn btn-primary btn-sm">Lista pizz</a></span>
Expand Down
1 change: 0 additions & 1 deletion malybar/pizza/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from django.conf.urls import url
from . import views
from django.contrib.auth.decorators import login_required
Expand Down
6 changes: 2 additions & 4 deletions malybar/pizza/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-

# from django.http import HttpResponse
from django.shortcuts import render
from .models import Pizza, Skladnik
from .forms import PizzaForm, SkladnikiFormSet
Expand All @@ -9,11 +8,10 @@
from django.forms.models import modelformset_factory


# Create your views here.
def index(request):
"""Strona główna"""
# return HttpResponse("Witaj!")
return render(request, "pizza/index.html")
kontekst = {'komunikat': 'Witaj w aplikacji Pizza!'}
return render(request, 'pizza/index.html', kontekst)


class PizzaCreate(CreateView):
Expand Down

0 comments on commit 00141c5

Please sign in to comment.