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.
28 lines
817 B
28 lines
817 B
from django.shortcuts import render
|
|
from django.contrib.auth.mixins import PermissionRequiredMixin
|
|
from django.views.generic import ListView, DetailView, CreateView
|
|
from django.contrib.auth.models import Permission
|
|
from django.contrib.auth.decorators import permission_required
|
|
|
|
from .models import Project
|
|
from users.models import User
|
|
from .forms import ProjectForm
|
|
|
|
|
|
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']
|
|
form_class = ProjectForm
|
|
success_url = '/projects/'
|
|
|