2018-05-21 22:04:29 +02:00
|
|
|
from django.shortcuts import get_object_or_404
|
|
|
|
from django.views.generic import CreateView, FormView, TemplateView
|
2018-05-21 19:28:36 +02:00
|
|
|
|
2018-05-21 21:03:08 +02:00
|
|
|
from manuels.models import Teacher
|
|
|
|
|
|
|
|
|
|
|
|
class HomePageView(CreateView):
|
|
|
|
model = Teacher
|
2018-05-21 22:04:29 +02:00
|
|
|
fields = ['first_name', 'last_name', 'phone_number']
|
2018-05-21 21:03:08 +02:00
|
|
|
template_name = 'manuels/home_page.html'
|
2018-05-21 22:04:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
class AddBookView(TemplateView):
|
|
|
|
template_name = 'manuels/add_book.html'
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs):
|
|
|
|
context = super().get_context_data()
|
|
|
|
context['teacher'] = get_object_or_404(Teacher, pk=self.kwargs['id'])
|
|
|
|
|
|
|
|
return context
|