1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
from django.views.generic import CreateView, ListView, UpdateView, DeleteView
from django.views.generic.detail import DetailView
from django.views.generic.base import View, RedirectView
from django.shortcuts import get_object_or_404, render, redirect
from django.urls import reverse, reverse_lazy
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.decorators import list_route
from rest_framework import permissions
#from .serializers import NoteSerializer, NotebookSerializer
from .models import Topic, Category, Post
#from .forms import NoteForm, NotebookForm
from utils.views import LoggedInViewWithUser
class TopicListView(LoggedInViewWithUser, ListView):
model = Topic
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['category_list'] = Category.objects.all()
return context
class TopicDetailView(LoggedInViewWithUser, DetailView):
model = Topic
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['category_list'] = Category.objects.all()
return context
|