You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
933 B
36 lines
933 B
from django.shortcuts import render
|
|
from django.contrib.auth.mixins import PermissionRequiredMixin
|
|
from django.views.generic import ListView, DetailView, CreateView
|
|
|
|
from .models import Project, Portfolio
|
|
from .forms import ProjectForm, PortfolioForm
|
|
|
|
|
|
class ProjectListView(ListView):
|
|
model = Project
|
|
|
|
def get_context_data(self, **kwargs):
|
|
context = super(ProjectListView, self).get_context_data(**kwargs)
|
|
return context
|
|
|
|
|
|
class ProjectDetailView(DetailView):
|
|
model = Project
|
|
|
|
|
|
class ProjectCreateView(PermissionRequiredMixin, CreateView):
|
|
model = Project
|
|
permission_required = ['projects.add_project']
|
|
raise_exception = True
|
|
form_class = ProjectForm
|
|
success_url = '/projects/'
|
|
|
|
|
|
class PortfolioCreateView(PermissionRequiredMixin, CreateView):
|
|
model = Portfolio
|
|
form_class = PortfolioForm
|
|
permission_required = ['projects.add_portfolio']
|
|
success_url = '/projects/'
|
|
|
|
|
|
|
|
|