From 0fd661ea6bae299b69e65f90966304012eb794d2 Mon Sep 17 00:00:00 2001 From: akhilbatra898 Date: Sat, 15 Jul 2017 09:44:23 +0530 Subject: Add Authentication and Basic CRUD for Repos - Map urls to the CRUD views - Add html templates for the views - Set authentication settings Change-Id: Ifcfe39a8341d44376e322d195e995fcaa1716d7d Signed-off-by: akhilbatra898 --- qtip/web/bench/views.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'qtip/web/bench/views.py') diff --git a/qtip/web/bench/views.py b/qtip/web/bench/views.py index da5c56c3..786b67d5 100644 --- a/qtip/web/bench/views.py +++ b/qtip/web/bench/views.py @@ -1,6 +1,41 @@ +############################################################################## +# Copyright (c) 2017 akhil.batra@research.iiit.ac.in and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + # -*- coding: utf-8 -*- from __future__ import unicode_literals +from django.contrib.auth.mixins import LoginRequiredMixin +# from django.utils.decorators import method_decorator +from django.views.generic.edit import CreateView, UpdateView + +import models + # from django.shortcuts import render # Create your views here. + + +class ReposView(LoginRequiredMixin, CreateView): + model = models.Repo + fields = '__all__' + + def get_context_data(self, **kwargs): + context = super(ReposView, self).get_context_data(**kwargs) + context["repos"] = self.model.objects.all() + return context + + +class RepoUpdate(LoginRequiredMixin, UpdateView): + model = models.Repo + fields = '__all__' + + def get_context_data(self, **kwargs): + context = super(RepoUpdate, self).get_context_data(**kwargs) + context["repos"] = self.model.objects.all() + return context -- cgit 1.2.3-korg