from django.shortcuts import render from django.views.generic import DetailView, UpdateView from django.contrib.auth import get_user_model from apps.course.models import Course User = get_user_model() class UserView(DetailView): model = User template_name = 'user/profile.html' def get_context_data(self, object): context = super().get_context_data() context['published'] = Course.objects.filter(author=self.object, status=Course.PUBLISHED) context['paid'] = Course.objects.none() return context class UserEditView(UpdateView): model = User template_name = 'user/profile-settings.html' fields = ( 'first_name', )