mybuddy/core/views.py

28 lines
587 B
Python
Raw Normal View History

2017-08-15 19:14:03 +00:00
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.views.generic.base import TemplateView
2017-08-15 20:24:55 +00:00
from django.views.generic.edit import CreateView, UpdateView, DeleteView
2017-08-15 19:14:03 +00:00
2017-08-16 12:49:58 +00:00
from .models import Child
2017-08-15 19:14:03 +00:00
2017-08-15 20:24:55 +00:00
class Index(TemplateView):
2017-08-15 19:14:03 +00:00
template_name = 'core/index.html'
2017-08-15 20:24:55 +00:00
2017-08-16 12:49:58 +00:00
class ChildAdd(CreateView):
model = Child
2017-08-15 20:24:55 +00:00
fields = ['first_name', 'last_name', 'birth_date']
success_url = '/'
2017-08-16 12:49:58 +00:00
class ChildUpdate(UpdateView):
model = Child
2017-08-15 20:24:55 +00:00
fields = ['first_name', 'last_name', 'birth_date']
success_url = '/'
2017-08-16 12:49:58 +00:00
class ChildDelete(DeleteView):
model = Child