text stringlengths 0 1.05M | meta dict |
|---|---|
from django.shortcuts import HttpResponse, get_object_or_404, render_to_response
from django.template.loader import render_to_string
from django.contrib.auth.decorators import login_required
from django.core.serializers.json import DjangoJSONEncoder
from django.utils import timezone
from django.forms.models import mode... | {
"repo_name": "pickleshb/PyInvoice",
"path": "invoice/api.py",
"copies": "1",
"size": "6423",
"license": "mit",
"hash": 5921834168612143000,
"line_mean": 34.6833333333,
"line_max": 104,
"alpha_frac": 0.60703721,
"autogenerated": false,
"ratio": 3.756140350877193,
"config_test": false,
"has_no... |
from django.shortcuts import HttpResponse, HttpResponseRedirect
from django.conf import settings
import requests, json, time
def get_nearby(r):
try:
airport = r.GET["airport"]
duration = r.GET["duration"]
except: pass
# return HttpResponse("invalid request")
places = []
params_d... | {
"repo_name": "Hasan-Jawaheri/traveller",
"path": "server/webapi/api.py",
"copies": "1",
"size": "2174",
"license": "mit",
"hash": 5991979049216703000,
"line_mean": 30.9705882353,
"line_max": 111,
"alpha_frac": 0.5386384545,
"autogenerated": false,
"ratio": 4.003683241252302,
"config_test": fal... |
from django.shortcuts import HttpResponse, HttpResponseRedirect
from django.template import RequestContext, loader
from django.http import Http404
from django.core.urlresolvers import reverse
from django.shortcuts import render, get_object_or_404
from django.views import generic
from django.utils import timezone
from ... | {
"repo_name": "thinkAmi-sandbox/syakyo_Django_1_8_official_tutorial",
"path": "polls/views.py",
"copies": "1",
"size": "3199",
"license": "unlicense",
"hash": 2800286814806133000,
"line_mean": 32.6736842105,
"line_max": 80,
"alpha_frac": 0.6592685214,
"autogenerated": false,
"ratio": 3.7111368909... |
from django.shortcuts import HttpResponse, HttpResponseRedirect, render
from .forms import ShortenForm
from .models import Shorten
# Create your views here.
def url_encode(request):
user = request.user
if request.method == 'POST':
form = ShortenForm(request.POST)
if form.is_valid():
... | {
"repo_name": "aaronmyatt/mv_shorl",
"path": "short/views.py",
"copies": "1",
"size": "1135",
"license": "bsd-3-clause",
"hash": 5585196278080335000,
"line_mean": 28.1025641026,
"line_max": 72,
"alpha_frac": 0.5118942731,
"autogenerated": false,
"ratio": 4.70954356846473,
"config_test": false,
... |
from django.shortcuts import HttpResponse
from django.shortcuts import render_to_response
from django.shortcuts import get_object_or_404
from models import *
from django.contrib.sites.models import Site
from django.template import RequestContext
from tagging.models import Tag, TaggedItem
def sourcesHome(request):
... | {
"repo_name": "halitalptekin/PyTr",
"path": "src/sources/views.py",
"copies": "1",
"size": "2204",
"license": "bsd-3-clause",
"hash": 7336300058066966000,
"line_mean": 44.9166666667,
"line_max": 108,
"alpha_frac": 0.6855716878,
"autogenerated": false,
"ratio": 3.697986577181208,
"config_test": ... |
from django.shortcuts import HttpResponse
from django.template import loader
from django.views.generic import TemplateView, ListView, DetailView, CreateView, UpdateView, DeleteView
from django.urls import reverse_lazy
from agendjang.models import Task, ScheduledTask, DateRange, Tag
from agendjang.forms import TaskFor... | {
"repo_name": "Guilouf/AgenDjang",
"path": "hostproject/agendjang/views.py",
"copies": "1",
"size": "2720",
"license": "apache-2.0",
"hash": -8061764721260282000,
"line_mean": 25.9306930693,
"line_max": 103,
"alpha_frac": 0.7125,
"autogenerated": false,
"ratio": 3.8255977496483826,
"config_test... |
from django.shortcuts import HttpResponse
from ray.tune.automlboard.models.models import JobRecord, TrialRecord
from ray.tune.trial import Trial
import json
def query_job(request):
"""Rest API to query the job info, with the given job_id.
The url pattern should be like this:
curl http://<server>:<port... | {
"repo_name": "stephanie-wang/ray",
"path": "python/ray/tune/automlboard/frontend/query.py",
"copies": "4",
"size": "3165",
"license": "apache-2.0",
"hash": 2251142098176125400,
"line_mean": 29.1428571429,
"line_max": 76,
"alpha_frac": 0.5570300158,
"autogenerated": false,
"ratio": 3.273009307135... |
from django.shortcuts import HttpResponse, redirect
from django.contrib.auth.models import User
from django.contrib.auth import login, authenticate
from django.middleware import csrf
def index(request):
if 'csrf_token' not in request.GET:
added_query_string = '?csrf_token=%s' if len(request.GET) == 0 else ... | {
"repo_name": "STU-Fudan/Chitoge",
"path": "API/views.py",
"copies": "1",
"size": "1742",
"license": "mit",
"hash": 1832879139431134200,
"line_mean": 40.5,
"line_max": 101,
"alpha_frac": 0.6555683123,
"autogenerated": false,
"ratio": 3.6985138004246285,
"config_test": false,
"has_no_keywords"... |
from django.shortcuts import HttpResponseRedirect
from django.urls import reverse_lazy
from django.db import connection
from django.shortcuts import redirect
import logging
import time
import operator
from rest_framework.authtoken.models import Token
logger = logging.getLogger("inventree")
class AuthRequiredMiddlew... | {
"repo_name": "SchrodingersGat/InvenTree",
"path": "InvenTree/InvenTree/middleware.py",
"copies": "2",
"size": "5881",
"license": "mit",
"hash": 3574100465425355300,
"line_mean": 35.9874213836,
"line_max": 100,
"alpha_frac": 0.5612990988,
"autogenerated": false,
"ratio": 4.8047385620915035,
"co... |
from django.shortcuts import HttpResponseRedirect
from django.urls import reverse
from django.views.generic.base import View, TemplateResponseMixin
from django.views.generic.edit import FormMixin, ProcessFormView
class FormActionMixin(object):
def post(self, request, *args, **kwargs):
"""Add 'Cancel' bu... | {
"repo_name": "pmsserrana/agenda",
"path": "agenda_administrativa/apps/atividades/mixins.py",
"copies": "1",
"size": "2157",
"license": "bsd-3-clause",
"hash": -6075841572890132000,
"line_mean": 31.1940298507,
"line_max": 78,
"alpha_frac": 0.668984701,
"autogenerated": false,
"ratio": 4.054511278... |
from django.shortcuts import HttpResponseRedirect
from django.views.generic import DetailView, ListView
from django.views.generic.edit import CreateView, UpdateView, DeleteView, FormView
from django.forms.models import modelform_factory
from django.core.urlresolvers import reverse
from guardian.mixins import LoginRequi... | {
"repo_name": "DArtagan/teetimer",
"path": "tracker/views.py",
"copies": "1",
"size": "6018",
"license": "mit",
"hash": 5539207999533627000,
"line_mean": 40.5034482759,
"line_max": 225,
"alpha_frac": 0.6457294782,
"autogenerated": false,
"ratio": 3.552538370720189,
"config_test": false,
"has_... |
from django.shortcuts import HttpResponseRedirect, render, get_object_or_404
from django.urls import reverse
from django.views import generic
from .models import Choice, Question
class IndexView(generic.ListView):
template_name = 'polls/index.html'
context_object_name = 'latest_question_list'
def get_query... | {
"repo_name": "gh4w/some",
"path": "web/weshgro/polls/views.py",
"copies": "1",
"size": "1589",
"license": "mit",
"hash": -4428539331420461600,
"line_mean": 35.8837209302,
"line_max": 83,
"alpha_frac": 0.6431273644,
"autogenerated": false,
"ratio": 3.8401937046004844,
"config_test": false,
"h... |
from django.shortcuts import HttpResponse, render, get_object_or_404
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.views import generic
from .models import Athlete, League, Sport, Team
from app_forms.... | {
"repo_name": "shermanng10/superathletebuilder",
"path": "athletes/views.py",
"copies": "1",
"size": "3628",
"license": "mit",
"hash": 8692321438474754000,
"line_mean": 26.0746268657,
"line_max": 72,
"alpha_frac": 0.7461411246,
"autogenerated": false,
"ratio": 3.0564448188711038,
"config_test":... |
from django.shortcuts import HttpResponse, render_to_response, HttpResponseRedirect, get_object_or_404
from intro.models import Menu, ScheduleEvents
import json
def home(request):
m = Menu.objects.filter(distiction=1)[:4]
return render_to_response('index.html', {'view': 'home', 'menu_list': m})
def menu(reque... | {
"repo_name": "blueooh/storehome",
"path": "intro/views.py",
"copies": "1",
"size": "1383",
"license": "apache-2.0",
"hash": -5559735318538155000,
"line_mean": 30.4318181818,
"line_max": 102,
"alpha_frac": 0.6348517715,
"autogenerated": false,
"ratio": 3.3325301204819278,
"config_test": false,
... |
from django.shortcuts import loader, get_object_or_404
from django.http import HttpResponse
from django.template import RequestContext
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
import datetime
from teamlogic import models
from utils.mixins import PaginatedViewMi... | {
"repo_name": "SarFootball/backend",
"path": "teamlogic/views.py",
"copies": "1",
"size": "3419",
"license": "apache-2.0",
"hash": 5125486586817350000,
"line_mean": 28.2222222222,
"line_max": 68,
"alpha_frac": 0.6768060837,
"autogenerated": false,
"ratio": 3.6333687566418704,
"config_test": fal... |
from django.shortcuts import *
from django.conf import settings
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView
from rest_framework.views import APIView
from rest_framework.permissions import IsAuthenticated
fro... | {
"repo_name": "kz26/uchicago-hvz",
"path": "uchicagohvz/chat/views.py",
"copies": "1",
"size": "1550",
"license": "mit",
"hash": 80982344829708910,
"line_mean": 35.0465116279,
"line_max": 101,
"alpha_frac": 0.7367741935,
"autogenerated": false,
"ratio": 3.2291666666666665,
"config_test": false,... |
from django.shortcuts import *
from django.contrib.auth.decorators import login_required, user_passes_test
from django.conf import settings
from social.apps.django_app.default.models import UserSocialAuth
import twitter
from home.forms import SourceForm
from home.models import Source, Statement, Event
def login(requ... | {
"repo_name": "daydreamt/vvsm",
"path": "home/views.py",
"copies": "1",
"size": "3472",
"license": "mit",
"hash": 8799320422891473000,
"line_mean": 26.784,
"line_max": 108,
"alpha_frac": 0.6419930876,
"autogenerated": false,
"ratio": 3.84070796460177,
"config_test": false,
"has_no_keywords": ... |
from django.shortcuts import *
from django.contrib.auth import views as auth_views
from django.contrib.auth.decorators import *
from django.contrib.auth.forms import PasswordResetForm
from django.utils.decorators import method_decorator
from django.contrib import messages
from django.shortcuts import render_to_response... | {
"repo_name": "Pitkid/bgundead",
"path": "bgundead/users/views.py",
"copies": "1",
"size": "4043",
"license": "mit",
"hash": -7847532033108914000,
"line_mean": 28.5109489051,
"line_max": 79,
"alpha_frac": 0.7172891417,
"autogenerated": false,
"ratio": 3.255233494363929,
"config_test": false,
... |
from django.shortcuts import *
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.template import RequestContext
from django.forms.models import modelform_factory
from django.contrib import auth
from django.core.context_processors import csrf
from django.views.decorators.csrf import csrf_pr... | {
"repo_name": "joonamo/photoplaces",
"path": "photoplaces/photoplaces_web/views.py",
"copies": "1",
"size": "2830",
"license": "mit",
"hash": 6613981482472121000,
"line_mean": 28.8,
"line_max": 125,
"alpha_frac": 0.6671378092,
"autogenerated": false,
"ratio": 3.4766584766584767,
"config_test": ... |
from django.shortcuts import *
from django.http import HttpResponse
from django.core.urlresolvers import reverse
from django.conf import settings
from ofreg.registration.models.password_reset import *
from ofreg import util
def forgotten(request):
if request.method == 'POST':
form = PasswordResetForm(request.POST)... | {
"repo_name": "ict-felix/stack",
"path": "ofreg/registration/views/password_reset.py",
"copies": "4",
"size": "1103",
"license": "apache-2.0",
"hash": -3451141098079202300,
"line_mean": 33.5,
"line_max": 142,
"alpha_frac": 0.7316409791,
"autogenerated": false,
"ratio": 3.4685534591194966,
"conf... |
from django.shortcuts import *
from django.http import HttpResponse
from django.core.urlresolvers import reverse
from django.conf import settings
from ofreg.registration.models.registration import *
from ofreg import util
def register(request):
if request.method == 'POST':
form = RegistrationForm(request.POST)
f... | {
"repo_name": "dana-i2cat/felix",
"path": "ofreg/registration/views/registration.py",
"copies": "4",
"size": "1847",
"license": "apache-2.0",
"hash": -5482273496557435000,
"line_mean": 37.4791666667,
"line_max": 159,
"alpha_frac": 0.753654575,
"autogenerated": false,
"ratio": 3.7162977867203217,
... |
from django.shortcuts import *
from django.http import *
from django import forms
import random
from oj_judge import problem_judge
from oj_judge.models import *
from problem.models import *
from contest.crawler import *
# Create your models here.
CHOICES=(('select1','select 1'), ('select2','select 2'),)
init_code = '... | {
"repo_name": "ISeaTeL/ISeaTeL_Cup_Site",
"path": "problem/views.py",
"copies": "1",
"size": "3260",
"license": "mit",
"hash": -6541717586742996000,
"line_mean": 34.4347826087,
"line_max": 102,
"alpha_frac": 0.5435582822,
"autogenerated": false,
"ratio": 4.0296662546353526,
"config_test": false... |
from django.shortcuts import *
from django.http import *
from .models import *
from datetime import *
from django.views.generic import *
from django.core.urlresolvers import *
from django.views.generic.edit import *
from blog.forms import *
import markdown2
class ArticleListView(ListView):
template_name='homepage.h... | {
"repo_name": "a0919610611/My-blog",
"path": "article/views.py",
"copies": "1",
"size": "4530",
"license": "mit",
"hash": 7985547506853457000,
"line_mean": 43.4117647059,
"line_max": 96,
"alpha_frac": 0.6770419426,
"autogenerated": false,
"ratio": 3.8389830508474576,
"config_test": false,
"ha... |
from django.shortcuts import *
from django.http import *
from models import *
import json
import os.path
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework import status
from django.views.decorators.csrf import csrf_exempt
# Create your views here.
def inde... | {
"repo_name": "IhtishamShah/GamifiedLearningApp",
"path": "Project/main/views.py",
"copies": "1",
"size": "2445",
"license": "mit",
"hash": -7396901163730762000,
"line_mean": 25.0212765957,
"line_max": 60,
"alpha_frac": 0.6830265849,
"autogenerated": false,
"ratio": 2.963636363636364,
"config_t... |
from django.shortcuts import *
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.core.paginator import Paginator
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_protect
from django.contrib.auth.models import User
f... | {
"repo_name": "aviraldg/quizzardous",
"path": "questions/views.py",
"copies": "1",
"size": "8565",
"license": "bsd-3-clause",
"hash": -7208173403335555000,
"line_mean": 35.7596566524,
"line_max": 122,
"alpha_frac": 0.6349095155,
"autogenerated": false,
"ratio": 4.202649656526006,
"config_test":... |
from django.shortcuts import (
get_object_or_404,
)
from django.utils import timezone
from haystack.inputs import AutoQuery
from haystack.query import SearchQuerySet, SQ
from rest_framework.permissions import IsAuthenticated
from rest_framework.views import APIView
from rest_framework import generics
from rest_fram... | {
"repo_name": "phildini/logtacts",
"path": "contacts/api/views.py",
"copies": "1",
"size": "6498",
"license": "mit",
"hash": -2873347744417697000,
"line_mean": 37,
"line_max": 95,
"alpha_frac": 0.6406586642,
"autogenerated": false,
"ratio": 4.224967490247074,
"config_test": false,
"has_no_key... |
from django.shortcuts import (
get_object_or_404,
redirect,
render,
)
from django.contrib.auth.decorators import login_required
import datetime
from django.utils import timezone
import calendar
from django.template.context_processors import csrf
from django.http import HttpResponseRedirect, JsonResponse, Ht... | {
"repo_name": "BobBowles/django-diary",
"path": "diary/views.py",
"copies": "1",
"size": "25016",
"license": "mit",
"hash": -8554488269092017000,
"line_mean": 27.8202764977,
"line_max": 79,
"alpha_frac": 0.5713143588,
"autogenerated": false,
"ratio": 3.9948898115618015,
"config_test": false,
... |
from django.shortcuts import (
get_object_or_404,
redirect,
render,
)
from .models import Lottery
def list_view(request):
lotteries = Lottery.objects.active()
if request.user.is_authenticated():
lotteries = lotteries.exclude(entrants=request.user)
context = {
"lotteries": lott... | {
"repo_name": "ToeKnee/Lottery-demo",
"path": "src/lottery/lotto/views.py",
"copies": "1",
"size": "1264",
"license": "bsd-2-clause",
"hash": 7294433643491994000,
"line_mean": 27.0888888889,
"line_max": 70,
"alpha_frac": 0.5814873418,
"autogenerated": false,
"ratio": 3.611428571428571,
"config_... |
from django.shortcuts import (
get_object_or_404, redirect, render)
from django.http import HttpResponseRedirect
class ObjectCreateMixin:
form_class = None
template_name = ''
def get(self, request):
return render(
request,
self.template_name,
{'form': self.... | {
"repo_name": "jmcevoy1984/Django-Unleashed",
"path": "suorganizer/organizer/utils.py",
"copies": "1",
"size": "2176",
"license": "mit",
"hash": 3612591838871320000,
"line_mean": 25.8765432099,
"line_max": 50,
"alpha_frac": 0.5243566176,
"autogenerated": false,
"ratio": 4.233463035019455,
"conf... |
from django.shortcuts import (
get_object_or_404, redirect, render)
from django.views.generic import View
from .models import Post
from .forms import PostForm
def post_detail(request, year, month, slug):
post = get_object_or_404(
Post,
pub_date__year=year,
pub_date__month=month,
... | {
"repo_name": "jmcevoy1984/Django-Unleashed",
"path": "suorganizer/blog/views.py",
"copies": "1",
"size": "2913",
"license": "mit",
"hash": -3406495529835913700,
"line_mean": 25.4909090909,
"line_max": 50,
"alpha_frac": 0.5217988328,
"autogenerated": false,
"ratio": 3.9958847736625516,
"config_... |
from django.shortcuts import (
get_object_or_404, render, redirect)
from django.views.generic import View
from django.core.urlresolvers import reverse_lazy
from .models import Startup, Tag
from .forms import NewsLinkForm, StartupForm, TagForm
from .utils import (
ObjectCreateMixin, ObjectUpdateMixin,
Objec... | {
"repo_name": "jmcevoy1984/Django-Unleashed",
"path": "suorganizer/organizer/views.py",
"copies": "1",
"size": "3392",
"license": "mit",
"hash": 4584874624902722000,
"line_mean": 23.9485294118,
"line_max": 53,
"alpha_frac": 0.6143867925,
"autogenerated": false,
"ratio": 3.7899441340782123,
"con... |
from django.shortcuts import *
from contacts.models import *
from django.utils.text import slugify
def index(request):
companies = Company.objects.all()
return render(request, 'contacts/index.html', {'companies': companies})
def create_company(request):
categories = Category.objects.all()
if ... | {
"repo_name": "kikeh/contacts",
"path": "contacts/views.py",
"copies": "1",
"size": "3008",
"license": "mit",
"hash": 5958490510275063000,
"line_mean": 31.3440860215,
"line_max": 114,
"alpha_frac": 0.6313164894,
"autogenerated": false,
"ratio": 4.278805120910384,
"config_test": false,
"has_no... |
from django.shortcuts import (
render,
get_object_or_404,
)
from gallery.models import Gallery
from ministry.models import Ministry
from project.models import Project
from blog.models import Post
from .models import Slide
def home(request):
context = {}
context['carousel'] = Slide.objects.filter(active... | {
"repo_name": "patrickporto/soldajustica",
"path": "soldajustica/app/views.py",
"copies": "1",
"size": "1653",
"license": "mit",
"hash": -6848875586256432000,
"line_mean": 28.5357142857,
"line_max": 66,
"alpha_frac": 0.7047791894,
"autogenerated": false,
"ratio": 3.415289256198347,
"config_test... |
from django.shortcuts import (
render,
redirect,
get_object_or_404,
)
from django.http import Http404
from django.urls import reverse
from django.views.generic import ListView
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView
from django.utils.translation i... | {
"repo_name": "flavoi/diventi",
"path": "diventi/feedbacks/views.py",
"copies": "1",
"size": "6755",
"license": "apache-2.0",
"hash": -5642256607016786000,
"line_mean": 41.21875,
"line_max": 132,
"alpha_frac": 0.6399703923,
"autogenerated": false,
"ratio": 4.0400717703349285,
"config_test": fal... |
from django.shortcuts import redirect, get_object_or_404
from django.core.urlresolvers import reverse
from django.contrib.auth import logout
from django_simple_forum.models import Topic
class AdminMixin(object):
def dispatch(self, request, *args, **kwargs):
user = self.request.user
if not user.is... | {
"repo_name": "MicroPyramid/django-simple-forum",
"path": "django_simple_forum/mixins.py",
"copies": "1",
"size": "1423",
"license": "mit",
"hash": -3829554402012305000,
"line_mean": 36.4473684211,
"line_max": 89,
"alpha_frac": 0.6633872101,
"autogenerated": false,
"ratio": 4.0084507042253525,
... |
from django.shortcuts import redirect, get_object_or_404
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.conf import settings
from django.views.generic import View
from profiles.models import Profile
class VerifyEmailView(View):
def get(self, request, *args, **kwargs... | {
"repo_name": "jupiny/EnglishDiary",
"path": "english_diary/profiles/views/verify_email.py",
"copies": "2",
"size": "1250",
"license": "mit",
"hash": 7244826858337616000,
"line_mean": 30.25,
"line_max": 79,
"alpha_frac": 0.5624,
"autogenerated": false,
"ratio": 5.1020408163265305,
"config_test"... |
from django.shortcuts import redirect, get_object_or_404
from django.http import HttpResponse, HttpResponseNotAllowed, HttpResponseBadRequest
from ncgmp.models import Vocabulary, VocabularyConcept, AgeTerm
from ncgmp.utils import SimpleJsonResponse
def updateVocabulary(req, vocabId):
vocab = get_object_or_404(Voca... | {
"repo_name": "ncgmp09/ncgmp09-online",
"path": "vocab/views.py",
"copies": "1",
"size": "1907",
"license": "bsd-3-clause",
"hash": -8562934499579364000,
"line_mean": 36.4117647059,
"line_max": 103,
"alpha_frac": 0.6607236497,
"autogenerated": false,
"ratio": 3.667307692307692,
"config_test": f... |
from django.shortcuts import redirect, get_object_or_404
from django.template import RequestContext, loader
from django.http import HttpResponse
from mig_main.utility import get_previous_page, Permissions, get_message_dict
from mig_main import messages
from mig_main.models import AcademicTerm
from bookswap.models impo... | {
"repo_name": "tbpmig/mig-website",
"path": "bookswap/views.py",
"copies": "1",
"size": "13099",
"license": "apache-2.0",
"hash": 3559330956678416000,
"line_mean": 40.3217665615,
"line_max": 90,
"alpha_frac": 0.615085121,
"autogenerated": false,
"ratio": 4.079414512612893,
"config_test": false,... |
from django.shortcuts import redirect, get_object_or_404
from django.views.generic import ListView, DetailView, View
from .models import Thread, Reply
from .forms import ReplyForm
from django.contrib import messages
from django.http import HttpResponse
import json
class ForumView(ListView):
paginate_by = 2
t... | {
"repo_name": "mazulo/simplemooc",
"path": "simplemooc/forum/views.py",
"copies": "1",
"size": "3186",
"license": "mit",
"hash": -5804229314079393000,
"line_mean": 32.5263157895,
"line_max": 78,
"alpha_frac": 0.6087912088,
"autogenerated": false,
"ratio": 3.961442786069652,
"config_test": false... |
from django.shortcuts import redirect, get_object_or_404, render
from slides.models import Screen, Slide
def screens (request):
c = {}
c['screens'] = Screen.objects.all()
return render (request, "screens.html", c)
def index (request):
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
... | {
"repo_name": "Pr0jectX/KISS",
"path": "slides/views.py",
"copies": "1",
"size": "1290",
"license": "mit",
"hash": 3343605032574168000,
"line_mean": 19.15625,
"line_max": 73,
"alpha_frac": 0.6689922481,
"autogenerated": false,
"ratio": 3,
"config_test": false,
"has_no_keywords": false,
"few... |
from django.shortcuts import redirect
from busstops.models import Service, StopPoint
def real_ip_middleware(get_response):
def middleware(request):
if 'HTTP_X_REAL_IP' in request.META:
request.META['REMOTE_ADDR'] = request.META['HTTP_X_REAL_IP']
return get_response(request)
return ... | {
"repo_name": "stev-0/bustimes.org.uk",
"path": "busstops/middleware.py",
"copies": "1",
"size": "1654",
"license": "mpl-2.0",
"hash": 276410739695504060,
"line_mean": 33.4583333333,
"line_max": 120,
"alpha_frac": 0.5622732769,
"autogenerated": false,
"ratio": 4.398936170212766,
"config_test": ... |
from django.shortcuts import redirect
from django.conf import settings
__all__ = [
'LoginRequiredMiddleware',
]
class LoginRequiredMiddleware():
'''
This middleware flips Djangos default login_required usage. By default, all views are login required
You can use the @public decorator to make a fun... | {
"repo_name": "jamesmfriedman/django-primer",
"path": "primer/middleware/login_required_middleware.py",
"copies": "1",
"size": "2110",
"license": "apache-2.0",
"hash": -269545611816782460,
"line_mean": 38.0925925926,
"line_max": 104,
"alpha_frac": 0.5753554502,
"autogenerated": false,
"ratio": 4.... |
from django.shortcuts import redirect
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from carts.models import Cart
from .models import Order
class LoginRequiredMixin(object):
@method_decorator(login_required)
def dispatch(self, request, *args, **k... | {
"repo_name": "jbaek7023/CustomEcommerce",
"path": "src/orders/mixins.py",
"copies": "1",
"size": "1283",
"license": "mit",
"hash": -2157798535825179000,
"line_mean": 34.6666666667,
"line_max": 89,
"alpha_frac": 0.6360093531,
"autogenerated": false,
"ratio": 3.7514619883040936,
"config_test": f... |
from django.shortcuts import redirect
from django.contrib.auth.decorators import login_required
import SECURE_CONFIG
from django.core.urlresolvers import reverse
from django.http import HttpResponse
import oauth2
import json
from .models import *
import urllib, urllib2
from django.conf import settings
@login_required
... | {
"repo_name": "MIT-Model-Open-Data-and-Identity-System/django_sensible",
"path": "identity.py",
"copies": "1",
"size": "2275",
"license": "mit",
"hash": -655094354957150300,
"line_mean": 36.2950819672,
"line_max": 250,
"alpha_frac": 0.7428571429,
"autogenerated": false,
"ratio": 3.316326530612245... |
from django.shortcuts import redirect
from django.contrib.auth.models import User
from django.contrib.auth import login, logout
from django.conf import settings
import requests
PUBLIC_URL = settings.LIQUID_AUTH_PUBLIC_URL
INTERNAL_URL = settings.LIQUID_AUTH_INTERNAL_URL
CLIENT_ID = settings.LIQUID_AUTH_CLIENT_ID
CLIEN... | {
"repo_name": "hoover/search",
"path": "hoover/contrib/oauth2/views.py",
"copies": "1",
"size": "2371",
"license": "mit",
"hash": 9108419662399508000,
"line_mean": 29.3974358974,
"line_max": 75,
"alpha_frac": 0.6368620835,
"autogenerated": false,
"ratio": 3.625382262996942,
"config_test": false... |
from django.shortcuts import redirect
from django.contrib.auth.models import User
class EmailAuthBackend(object):
"""
Email Authentication Backend
Allows a user to sign in using an email/password pair.
"""
def authenticate(self, username=None, password=None):
""" Authenticate a user base... | {
"repo_name": "z0rr0/eshop",
"path": "shop/shop/addons.py",
"copies": "1",
"size": "1567",
"license": "mit",
"hash": -384973839000809800,
"line_mean": 26.0172413793,
"line_max": 76,
"alpha_frac": 0.5883854499,
"autogenerated": false,
"ratio": 4.258152173913044,
"config_test": false,
"has_no_k... |
from django.shortcuts import redirect
from django.contrib.auth.views import LoginView
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.db.models import Q
from django.urls import resolve, reverse
impo... | {
"repo_name": "MozillaSecurity/FuzzManager",
"path": "server/server/views.py",
"copies": "1",
"size": "6838",
"license": "mpl-2.0",
"hash": 7221761791404193000,
"line_mean": 34.9894736842,
"line_max": 105,
"alpha_frac": 0.6490201813,
"autogenerated": false,
"ratio": 4.192519926425506,
"config_t... |
from django.shortcuts import redirect
from django.contrib import messages
from django.contrib.contenttypes.models import ContentType
from .models import Course, CourseTRB, Enrollment
from .utils import get_course_by_instance
def enrollment_required(view_func):
def _wrapper(request, *args, **kwargs):
slug... | {
"repo_name": "mazulo/simplemooc",
"path": "simplemooc/courses/decorators.py",
"copies": "1",
"size": "1316",
"license": "mit",
"hash": 4996895038129304000,
"line_mean": 37.5294117647,
"line_max": 74,
"alpha_frac": 0.6015267176,
"autogenerated": false,
"ratio": 4.440677966101695,
"config_test":... |
from django.shortcuts import redirect
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from django.template.context import RequestContext
from smartmin.views import SmartCRUDL, SmartView, SmartCreateView, SmartReadView, SmartUpdateView,... | {
"repo_name": "savioabuga/phoenix",
"path": "phoenix/groups/views.py",
"copies": "1",
"size": "5785",
"license": "bsd-3-clause",
"hash": 2182705663530417000,
"line_mean": 42.171641791,
"line_max": 161,
"alpha_frac": 0.6231633535,
"autogenerated": false,
"ratio": 3.810935441370224,
"config_test"... |
from django.shortcuts import redirect
from django.contrib import messages
from django.utils.translation import ugettext as _
from users.models import UserGroup
from core.utils import lists_overlap
class ReportMixin(object):
"""
Can the user view this report?
"""
def dispatch(self, *args, **kwargs):... | {
"repo_name": "moshthepitt/answers",
"path": "reports/mixins.py",
"copies": "1",
"size": "1286",
"license": "mit",
"hash": -817306199455964200,
"line_mean": 39.1875,
"line_max": 128,
"alpha_frac": 0.6384136858,
"autogenerated": false,
"ratio": 4.745387453874539,
"config_test": false,
"has_no_... |
from django.shortcuts import redirect
from django.contrib import messages
from django.utils.translation import ugettext as _
from users.models import UserProfile, UserGroup
from questions.models import Quiz, Sitting
class AdminMixin(object):
"""
Restricts views to only admin users
"""
def dispatch(... | {
"repo_name": "moshthepitt/answers",
"path": "core/mixins.py",
"copies": "1",
"size": "3211",
"license": "mit",
"hash": 2471855760587328000,
"line_mean": 32.8,
"line_max": 99,
"alpha_frac": 0.598255995,
"autogenerated": false,
"ratio": 4.73598820058997,
"config_test": false,
"has_no_keywords"... |
from django.shortcuts import redirect
from django.core.exceptions import MiddlewareNotUsed
from django.conf import settings
import logging
logger = logging.getLogger(__name__)
# Adapted from https://github.com/etianen/django-herokuapp/blob/bd0a5d6af08f4d5f90b202bb6be1494b1a9850e1/herokuapp/middleware.py
class Canonic... | {
"repo_name": "GrantHeaslip/ghweb",
"path": "ghweb/middleware.py",
"copies": "1",
"size": "2082",
"license": "bsd-3-clause",
"hash": -2731817192121634300,
"line_mean": 31.0307692308,
"line_max": 128,
"alpha_frac": 0.5869356388,
"autogenerated": false,
"ratio": 4.319502074688796,
"config_test": ... |
from django.shortcuts import redirect
from django.core.exceptions import MiddlewareNotUsed
from django.conf import settings
from herokuapp.settings import SITE_DOMAIN
class CanonicalDomainMiddleware(object):
"""Middleware that redirects to a canonical domain."""
def __init__(self):
if setti... | {
"repo_name": "etianen/django-herokuapp",
"path": "herokuapp/middleware.py",
"copies": "3",
"size": "1121",
"license": "bsd-3-clause",
"hash": 680441915429205200,
"line_mean": 36.4,
"line_max": 74,
"alpha_frac": 0.6271186441,
"autogenerated": false,
"ratio": 4.538461538461538,
"config_test": fa... |
from django.shortcuts import redirect
from django.core.mail import send_mail
from django.conf import settings
from django.contrib.sites.models import Site, RequestSite
from django.contrib.auth.models import Group
from django.template.loader import render_to_string
from registration.models import RegistrationProfile
U... | {
"repo_name": "chop-dbhi/brptoolkit-demo-harvest",
"path": "brp_demo/pipeline.py",
"copies": "1",
"size": "1578",
"license": "bsd-2-clause",
"hash": -7868883446974907000,
"line_mean": 32.5744680851,
"line_max": 76,
"alpha_frac": 0.6495564005,
"autogenerated": false,
"ratio": 4.06701030927835,
"... |
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
from approver.workflows import project_crud
from approver import constants
import approver.utils as utils
@login_required
def similar_projects(request, project_id=None,from_pag... | {
"repo_name": "ctsit/qipr_approver",
"path": "qipr_approver/approver/views/similar_projects.py",
"copies": "3",
"size": "1384",
"license": "apache-2.0",
"hash": 2257764139189922800,
"line_mean": 37.4444444444,
"line_max": 89,
"alpha_frac": 0.6401734104,
"autogenerated": false,
"ratio": 4.18126888... |
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.utils import timezone
from approver.models import Person
from approver.constants import SESSION_VARS
from . import user_crud
def add_shib_information_to_session(request):
"""
... | {
"repo_name": "amberlallen/qipr_approver",
"path": "qipr_approver/approver/workflows/shib.py",
"copies": "1",
"size": "1711",
"license": "apache-2.0",
"hash": -4517687001439264000,
"line_mean": 40.7317073171,
"line_max": 87,
"alpha_frac": 0.7142022209,
"autogenerated": false,
"ratio": 3.879818594... |
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.views import generic
from django.views.generic import detail
from django.contrib.auth.decorators import login_required
from django.contrib.auth import logout as auth_logout
from django.template import RequestContext
from soci... | {
"repo_name": "ThrowsException/CLeagueHero",
"path": "arenas/views.py",
"copies": "1",
"size": "4889",
"license": "mit",
"hash": -8959617915279214000,
"line_mean": 29.55625,
"line_max": 106,
"alpha_frac": 0.6369400695,
"autogenerated": false,
"ratio": 3.825508607198748,
"config_test": false,
... |
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from social.pipeline.partial import partial
from account.views import add_password
@partial
def get_user_details(strategy, details, is_new=False, *args, **kwargs):
"""Asks new users to choose a username and verify their email addre... | {
"repo_name": "anantb/datahub",
"path": "src/account/pipeline.py",
"copies": "3",
"size": "1520",
"license": "mit",
"hash": -2355070948032324600,
"line_mean": 39,
"line_max": 77,
"alpha_frac": 0.6671052632,
"autogenerated": false,
"ratio": 4.305949008498583,
"config_test": false,
"has_no_keyw... |
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from system.controllers.postFinishView import finish
from system.models import Reserved, Equipment
from system.controllers.utils import reverse_or_404
def reservePost(request):
# リダイレクト先の受け取り
backname = request.GET.get("backnam... | {
"repo_name": "XMLPro/ManagementSystem",
"path": "system/controllers/reservePost.py",
"copies": "1",
"size": "1520",
"license": "mit",
"hash": -4926786894466757000,
"line_mean": 36.7435897436,
"line_max": 78,
"alpha_frac": 0.6711956522,
"autogenerated": false,
"ratio": 3.652605459057072,
"confi... |
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
import views_base as viewb
import django.views.generic.edit as generic_editor
import django.forms.models as form_models
import settings
from django.contrib.auth.views import password_change
class HotEdit(viewb.TemplateBase):
templat... | {
"repo_name": "samuelcolvin/HotDjango",
"path": "editor.py",
"copies": "1",
"size": "6164",
"license": "mit",
"hash": 129417203561574450,
"line_mean": 41.8125,
"line_max": 136,
"alpha_frac": 0.6059377028,
"autogenerated": false,
"ratio": 3.869428750784683,
"config_test": false,
"has_no_keywor... |
from django.shortcuts import redirect
from django.http import Http404, HttpResponse
from django.urls import reverse_lazy
from django.views.generic import ListView, View, TemplateView
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
import json
from .models... | {
"repo_name": "pawel-wlk/ecommerce-site",
"path": "mysite/cart/views.py",
"copies": "1",
"size": "1949",
"license": "mit",
"hash": 8302941948383440000,
"line_mean": 27.6617647059,
"line_max": 81,
"alpha_frac": 0.6413545408,
"autogenerated": false,
"ratio": 3.7123809523809523,
"config_test": fal... |
from django.shortcuts import redirect
from django.http import Http404
from django.views.generic.edit import FormView, UpdateView, DeleteView
from django.views.generic import ListView
from django.contrib.auth import authenticate, login, logout
from django.core.urlresolvers import reverse, reverse_lazy
from .models impo... | {
"repo_name": "pawel-wlk/ecommerce-site",
"path": "mysite/info/views.py",
"copies": "1",
"size": "2504",
"license": "mit",
"hash": -3244089862600701400,
"line_mean": 27.1348314607,
"line_max": 83,
"alpha_frac": 0.6661341853,
"autogenerated": false,
"ratio": 3.8346094946401226,
"config_test": fa... |
from django.shortcuts import redirect
from django.http import HttpRequest
from frontpage.models import Article, ArticleMedia, Profile, Media, Settings
from frontpage.management.magic import get_current_user, parse_bool
from frontpage.management.magic import compile_markdown
import logging
logger: logging.Logger = logg... | {
"repo_name": "Technikradio/C3FOCSite",
"path": "c3shop/frontpage/management/articletools/article_actions.py",
"copies": "1",
"size": "4882",
"license": "bsd-3-clause",
"hash": -484436317372966100,
"line_mean": 38.056,
"line_max": 118,
"alpha_frac": 0.6259729619,
"autogenerated": false,
"ratio": ... |
from django.shortcuts import redirect
from django.http import HttpResponse, HttpResponseRedirect
from comments.forms import CommentForm
from posts.forms import PostForm
from .models import Author
from .models import Post, Comment
from django.contrib.auth import get_user_model
from django.utils import timezone
from djan... | {
"repo_name": "CMPUT404Proj/CMPUT404-project-socialdistribution",
"path": "social_dist/comments/views.py",
"copies": "1",
"size": "1306",
"license": "apache-2.0",
"hash": 5861757386582480000,
"line_mean": 31.65,
"line_max": 69,
"alpha_frac": 0.67381317,
"autogenerated": false,
"ratio": 4.04334365... |
from django.shortcuts import redirect
from django.http import HttpResponse
from django.views.generic import TemplateView
from django.views.generic import ListView, DetailView
from django.views.generic.edit import FormView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.core.urlresol... | {
"repo_name": "futurice/futurice-ldap-user-manager",
"path": "fum/projects/views.py",
"copies": "1",
"size": "3049",
"license": "bsd-3-clause",
"hash": -358803674795296960,
"line_mean": 34.0459770115,
"line_max": 109,
"alpha_frac": 0.6802230239,
"autogenerated": false,
"ratio": 3.79228855721393,
... |
from django.shortcuts import redirect
from django.shortcuts import get_object_or_404
from django.views.generic import TemplateView
from django.views.generic import ListView, DetailView
from django.views.generic.edit import FormView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.cor... | {
"repo_name": "futurice/futurice-ldap-user-manager",
"path": "fum/groups/views.py",
"copies": "1",
"size": "3048",
"license": "bsd-3-clause",
"hash": -113103984683836830,
"line_mean": 33.2471910112,
"line_max": 106,
"alpha_frac": 0.6745406824,
"autogenerated": false,
"ratio": 3.7216117216117217,
... |
from django.shortcuts import redirect
from django.shortcuts import render
from django.contrib.auth.models import User
from django.views.generic.base import View
from perfis.models import Perfil
from usuarios.forms import RegistrarUsuarioForm
class RegistrarUsuarioView(View):
template_name = 'registrar.html'
... | {
"repo_name": "alvarocneto/alura_django",
"path": "usuarios/views.py",
"copies": "1",
"size": "1485",
"license": "mit",
"hash": 1533819909514070000,
"line_mean": 31.2826086957,
"line_max": 72,
"alpha_frac": 0.5373737374,
"autogenerated": false,
"ratio": 4.279538904899136,
"config_test": false,
... |
from django.shortcuts import redirect
from django.shortcuts import render
from django.utils import timezone
from .models import Post
from django.shortcuts import render, get_object_or_404
from .forms import PostForm
from django.contrib.auth.decorators import login_required
def post_list(request):
posts = Post.obje... | {
"repo_name": "GalkaS/djangoblog",
"path": "blog/views.py",
"copies": "1",
"size": "2027",
"license": "mit",
"hash": -8128758506008515000,
"line_mean": 31.6935483871,
"line_max": 94,
"alpha_frac": 0.6630488407,
"autogenerated": false,
"ratio": 3.470890410958904,
"config_test": false,
"has_no_... |
from django.shortcuts import redirect
from django.shortcuts import render
from django.views.decorators.cache import never_cache
from django.contrib.auth.decorators import permission_required
from django.contrib.auth.decorators import login_required
from registration.backends import get_backend
def register(request, ba... | {
"repo_name": "chop-dbhi/biorepo-portal",
"path": "registration/views.py",
"copies": "1",
"size": "3005",
"license": "bsd-2-clause",
"hash": 7470226984663528000,
"line_mean": 35.6463414634,
"line_max": 108,
"alpha_frac": 0.6908485857,
"autogenerated": false,
"ratio": 4.244350282485875,
"config_... |
from django.shortcuts import redirect
from django.shortcuts import render
from django.views.decorators.cache import never_cache
from django.contrib.auth.decorators import permission_required
from registration.backends import get_backend
def register(request, backend='default', template_name='registration/registration... | {
"repo_name": "bruth/django-registration2",
"path": "registration/views.py",
"copies": "1",
"size": "2912",
"license": "bsd-3-clause",
"hash": 7702664624424808000,
"line_mean": 35.4,
"line_max": 108,
"alpha_frac": 0.6868131868,
"autogenerated": false,
"ratio": 4.257309941520468,
"config_test": ... |
from django.shortcuts import redirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from captcha.forms import RegistrationFormCaptcha
from registration.backends import get_backend
# Custom register view for James Bennett's django-registration re-usable app to add reCaptcha
... | {
"repo_name": "mozilla/django-recaptcha",
"path": "captcha/views.py",
"copies": "2",
"size": "4761",
"license": "bsd-3-clause",
"hash": 1823931290947729700,
"line_mean": 38.0327868852,
"line_max": 93,
"alpha_frac": 0.6656164671,
"autogenerated": false,
"ratio": 4.626822157434402,
"config_test":... |
from django.shortcuts import redirect
from django.template import RequestContext
from django.http import HttpResponse
from django.shortcuts import render
from documents.models import Document
import os
import mimetypes
from documents.forms import DocumentForm
from django.core.context_processors import csrf
from django.... | {
"repo_name": "mdavoodi/konkourse-python",
"path": "documents/views.py",
"copies": "1",
"size": "4410",
"license": "mit",
"hash": -1980199306525472300,
"line_mean": 33.1860465116,
"line_max": 109,
"alpha_frac": 0.6117913832,
"autogenerated": false,
"ratio": 4.260869565217392,
"config_test": fal... |
from django.shortcuts import redirect
from django.template import RequestContext
from mezzanine.conf import settings
from mezzanine.forms.forms import FormForForm
from mezzanine.forms.models import Form
from mezzanine.forms.signals import form_invalid, form_valid
from mezzanine.pages.page_processors import processor_f... | {
"repo_name": "stephenmcd/mezzanine",
"path": "mezzanine/forms/page_processors.py",
"copies": "2",
"size": "2590",
"license": "bsd-2-clause",
"hash": -1073918511683151200,
"line_mean": 33.0789473684,
"line_max": 87,
"alpha_frac": 0.5980694981,
"autogenerated": false,
"ratio": 3.996913580246914,
... |
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from .discount import add_voucher_form, validate_voucher
from .shipping import (anonymous_user_shipping_address_view,
user_shipping_address_view)
from .summary import (
summary_with_shipping_view, ano... | {
"repo_name": "jonathanmeier5/teamstore",
"path": "saleor/checkout/views/__init__.py",
"copies": "1",
"size": "2906",
"license": "bsd-3-clause",
"hash": 5180158577476979000,
"line_mean": 32.0227272727,
"line_max": 93,
"alpha_frac": 0.7271163111,
"autogenerated": false,
"ratio": 4.087201125175809,... |
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from ..forms import AnonymousUserShippingForm, ShippingAddressesForm
from ...userprofile.forms import AddressForm
from ...userprofile.models import Address
def anonymous_user_shipping_address_view(request, checkout):
data... | {
"repo_name": "laosunhust/saleor",
"path": "saleor/checkout/views/shipping.py",
"copies": "3",
"size": "2863",
"license": "bsd-3-clause",
"hash": 4006931133177082400,
"line_mean": 46.7166666667,
"line_max": 88,
"alpha_frac": 0.6971707999,
"autogenerated": false,
"ratio": 4.445652173913044,
"con... |
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from ..forms import AnonymousUserShippingForm, ShippingAddressesForm
from ...userprofile.forms import get_address_form
from ...userprofile.models import Address
from ...teamstore.utils import get_team
def anonymous_user_shipp... | {
"repo_name": "jonathanmeier5/teamstore",
"path": "saleor/checkout/views/shipping.py",
"copies": "1",
"size": "3737",
"license": "bsd-3-clause",
"hash": 4980423308500335000,
"line_mean": 43.4880952381,
"line_max": 87,
"alpha_frac": 0.6729997324,
"autogenerated": false,
"ratio": 4.391304347826087,... |
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from ..forms import (
AnonymousUserBillingForm, BillingAddressesForm, BillingWithoutShippingAddressForm)
from ...userprofile.forms import AddressForm
from ...userprofile.models import Address
def create_order(checkout):
... | {
"repo_name": "rchav/vinerack",
"path": "saleor/checkout/views/summary.py",
"copies": "4",
"size": "5753",
"license": "bsd-3-clause",
"hash": -2223212886211548200,
"line_mean": 46.1557377049,
"line_max": 88,
"alpha_frac": 0.6815574483,
"autogenerated": false,
"ratio": 4.40168324407039,
"config_... |
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from ..forms import ShippingMethodForm
from .discount import add_voucher_form
from .validators import (
validate_cart, validate_shipping_address,
validate_shipping_method, validate_is_shipping_required)
from .shipping i... | {
"repo_name": "laosunhust/saleor",
"path": "saleor/checkout/views/__init__.py",
"copies": "3",
"size": "2016",
"license": "bsd-3-clause",
"hash": 8658391279625329000,
"line_mean": 36.3333333333,
"line_max": 89,
"alpha_frac": 0.7589285714,
"autogenerated": false,
"ratio": 4.032,
"config_test": f... |
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from ..forms import ShippingMethodForm
from .discount import add_voucher_form, validate_voucher
from .validators import (
validate_cart, validate_shipping_address,
validate_shipping_method, validate_is_shipping_required... | {
"repo_name": "fnugrahendi/saleor",
"path": "saleor/checkout/views/__init__.py",
"copies": "2",
"size": "2088",
"license": "bsd-3-clause",
"hash": -6169504018982512000,
"line_mean": 35.6315789474,
"line_max": 89,
"alpha_frac": 0.7614942529,
"autogenerated": false,
"ratio": 4.023121387283237,
"c... |
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from ..utils import (
get_checkout_context, get_taxes_for_checkout,
update_shipping_address_in_anonymous_checkout,
update_shipping_address_in_checkout)
def anonymous_user_shipping_address_view(request, checkout):
... | {
"repo_name": "UITools/saleor",
"path": "saleor/checkout/views/shipping.py",
"copies": "1",
"size": "1863",
"license": "bsd-3-clause",
"hash": 7328698179335777000,
"line_mean": 37.0204081633,
"line_max": 80,
"alpha_frac": 0.7101449275,
"autogenerated": false,
"ratio": 4.121681415929204,
"config... |
from django.shortcuts import redirect
from django.urls import reverse
from django.urls import reverse_lazy
import core.forms.ansible_user
from core import models
from core.generic import mixins
from core.generic import views
class Search(mixins.PermissionRequiredMixin, mixins.FormMixin, views.ListView):
templat... | {
"repo_name": "telminov/ansible-manager",
"path": "core/views/ansible_user.py",
"copies": "1",
"size": "2463",
"license": "mit",
"hash": -7474050051265364000,
"line_mean": 28.6746987952,
"line_max": 79,
"alpha_frac": 0.6224116931,
"autogenerated": false,
"ratio": 3.878740157480315,
"config_test... |
from django.shortcuts import redirect
from django.urls import reverse
from django.urls import reverse_lazy
import core.forms.host_group
from core import models
from core.generic import mixins
from core.generic import views
class Search(mixins.PermissionRequiredMixin, mixins.FormMixin, views.ListView):
template_... | {
"repo_name": "telminov/ansible-manager",
"path": "core/views/host_group.py",
"copies": "1",
"size": "2976",
"license": "mit",
"hash": 371329193708179650,
"line_mean": 30.6595744681,
"line_max": 92,
"alpha_frac": 0.6189516129,
"autogenerated": false,
"ratio": 3.84993531694696,
"config_test": fa... |
from django.shortcuts import redirect
from django.urls import reverse
from django.urls import reverse_lazy
import core.forms.host
from core import models
from core.generic import mixins
from core.generic import views
class Search(mixins.PermissionRequiredMixin, mixins.FormMixin, views.ListView):
template_name =... | {
"repo_name": "telminov/ansible-manager",
"path": "core/views/host.py",
"copies": "1",
"size": "3328",
"license": "mit",
"hash": -2866660569043960300,
"line_mean": 30.1028037383,
"line_max": 92,
"alpha_frac": 0.6018629808,
"autogenerated": false,
"ratio": 3.8969555035128804,
"config_test": fals... |
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.encoding import iri_to_uri
from social.app.models.author import Author
class AuthRequiredMiddleware(object):
"""
Forces a redirect to the login on all restricted pages.
Forces a redirect to the home page on accessing... | {
"repo_name": "TeamAADGT/CMPUT404-project-socialdistribution",
"path": "social/middleware/auth/middleware.py",
"copies": "1",
"size": "1715",
"license": "apache-2.0",
"hash": -7764831572565782000,
"line_mean": 45.3513513514,
"line_max": 117,
"alpha_frac": 0.5626822157,
"autogenerated": false,
"ra... |
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.http import urlencode
from consents.util import person_has_consented_to_required_terms
class TermsMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
... | {
"repo_name": "pbanaszkiewicz/amy",
"path": "amy/consents/middleware.py",
"copies": "1",
"size": "1367",
"license": "mit",
"hash": -411043663818771000,
"line_mean": 34.0512820513,
"line_max": 78,
"alpha_frac": 0.6159473299,
"autogenerated": false,
"ratio": 4.193251533742331,
"config_test": fals... |
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.http import urlencode
class PrivacyPolicy:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
url = reverse('action_required_privacy')
allowed_urls = [... | {
"repo_name": "swcarpentry/amy",
"path": "amy/workshops/action_required.py",
"copies": "1",
"size": "1382",
"license": "mit",
"hash": -3748720752781933600,
"line_mean": 32.7073170732,
"line_max": 78,
"alpha_frac": 0.5897250362,
"autogenerated": false,
"ratio": 4.401273885350318,
"config_test": ... |
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.translation import gettext as _
from django.utils.translation import gettext_lazy
from django.views.generic.base import TemplateResponseMixin
from django.views.generic.edit import BaseCreateView, BaseDeleteView, BaseUpdateView
from ... | {
"repo_name": "torchbox/wagtail",
"path": "wagtail/admin/views/generic.py",
"copies": "2",
"size": "8292",
"license": "bsd-3-clause",
"hash": -1688098590058593800,
"line_mean": 32.9836065574,
"line_max": 101,
"alpha_frac": 0.6449589966,
"autogenerated": false,
"ratio": 4.160561966884094,
"confi... |
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy
from django.views.generic.base import TemplateResponseMixin
from django.views.generic.edit import BaseCreateView, BaseDeleteView, BaseUpdateView
fro... | {
"repo_name": "mikedingjan/wagtail",
"path": "wagtail/admin/views/generic.py",
"copies": "5",
"size": "7614",
"license": "bsd-3-clause",
"hash": -6393026328156311000,
"line_mean": 32.6902654867,
"line_max": 95,
"alpha_frac": 0.6448647229,
"autogenerated": false,
"ratio": 4.129067245119306,
"con... |
from django.shortcuts import redirect
from django.utils.cache import add_never_cache_headers
from django.core.signing import TimestampSigner, BadSignature
from django.contrib.auth.models import User
from . import app_settings
from .utils import login, strip_token, get_user_salt
class AutomaticLoginMiddleware(object):... | {
"repo_name": "playfire/django-autologin",
"path": "django_autologin/middleware.py",
"copies": "2",
"size": "1519",
"license": "bsd-3-clause",
"hash": 5125886268442271000,
"line_mean": 27.1296296296,
"line_max": 76,
"alpha_frac": 0.590520079,
"autogenerated": false,
"ratio": 4.290960451977401,
... |
from django.shortcuts import redirect
from django.utils.cache import patch_vary_headers
from amo.helpers import urlparams
from amo.urlresolvers import set_url_prefix
from mkt.constants.carriers import CARRIER_MAP
from . import set_carrier
class CarrierURLMiddleware(object):
"""
Supports psuedo-URL prefixes ... | {
"repo_name": "Joergen/zamboni",
"path": "mkt/carriers/middleware.py",
"copies": "1",
"size": "1562",
"license": "bsd-3-clause",
"hash": 400954294823846000,
"line_mean": 30.8775510204,
"line_max": 77,
"alpha_frac": 0.6690140845,
"autogenerated": false,
"ratio": 3.964467005076142,
"config_test":... |
from django.shortcuts import redirect
from django.utils.datastructures import MultiValueDict
from django.utils.http import urlencode
from .models import Tour
def tour_middleware(get_response):
# One-time configuration and initialization.
def middleware(request):
# Code to be executed for each reques... | {
"repo_name": "Flyingfox646/flyingfox",
"path": "src/stats/middleware.py",
"copies": "1",
"size": "1191",
"license": "mit",
"hash": -7940820300531206000,
"line_mean": 32.0833333333,
"line_max": 115,
"alpha_frac": 0.6280436608,
"autogenerated": false,
"ratio": 4.284172661870503,
"config_test": f... |
from django.shortcuts import redirect
from django.utils import timezone
from system.models import Equipment, Reserved, Log
import datetime
from system.controllers.postFinishView import finish
from system.controllers.utils import reverse_or_404
def borrowPost(request):
# [ 貸出処理 ]を行います
# equipmentにborrwerの登録、Le... | {
"repo_name": "XMLPro/ManagementSystem",
"path": "system/controllers/borrowReturnPost.py",
"copies": "1",
"size": "2960",
"license": "mit",
"hash": -598687618491240400,
"line_mean": 26.8876404494,
"line_max": 74,
"alpha_frac": 0.6619661563,
"autogenerated": false,
"ratio": 2.5352400408580182,
"... |
from django.shortcuts import redirect
from django.utils import translation
from django.conf import settings
from django.core.urlresolvers import resolve, Resolver404
from djangocms_siteselector.helpers import get_current_site
class LocaleMiddleware(object):
"""
Middleware for changing language
"""
de... | {
"repo_name": "Assembly-WebCrew/cms",
"path": "assembly/middlewares.py",
"copies": "3",
"size": "1481",
"license": "mit",
"hash": 3210783879523172000,
"line_mean": 36.9743589744,
"line_max": 82,
"alpha_frac": 0.6191762323,
"autogenerated": false,
"ratio": 5.0893470790378,
"config_test": false,
... |
from django.shortcuts import redirect
from django.utils.translation import ugettext as _
from django.contrib import messages
from django.db.models import Q
from projector.models import Status, Transition
from projector.views.project import ProjectView
from projector.forms import StatusForm, StatusFormSet
from richtem... | {
"repo_name": "lukaszb/django-projector",
"path": "projector/views/project_workflow.py",
"copies": "1",
"size": "3200",
"license": "bsd-3-clause",
"hash": 2943871909861773000,
"line_mean": 34.9550561798,
"line_max": 79,
"alpha_frac": 0.59375,
"autogenerated": false,
"ratio": 4.664723032069971,
... |
from django.shortcuts import redirect
from django.utils.translation import ugettext as _
from django.http import HttpResponse, HttpRequest
from zerver.decorator import require_realm_admin
from zerver.lib.actions import do_change_icon_source
from zerver.lib.realm_icon import realm_icon_url
from zerver.lib.response impo... | {
"repo_name": "samatdav/zulip",
"path": "zerver/views/realm_icon.py",
"copies": "1",
"size": "2024",
"license": "apache-2.0",
"hash": 7425596840378100000,
"line_mean": 35.8,
"line_max": 84,
"alpha_frac": 0.7248023715,
"autogenerated": false,
"ratio": 3.741219963031423,
"config_test": false,
"... |
from django.shortcuts import redirect
from django.utils.translation import ugettext_lazy as _
from django.contrib import admin
from ctf_gameserver.web.admin import admin_site
from . import models, forms
@admin.register(models.Service, site=admin_site)
class ServiceAdmin(admin.ModelAdmin):
prepopulated_fields = ... | {
"repo_name": "fausecteam/ctf-gameserver",
"path": "src/ctf_gameserver/web/scoring/admin.py",
"copies": "1",
"size": "3071",
"license": "isc",
"hash": 283155422046016900,
"line_mean": 32.0215053763,
"line_max": 108,
"alpha_frac": 0.6541843048,
"autogenerated": false,
"ratio": 4.046113306982872,
... |
from django.shortcuts import redirect
from django.utils.translation import ugettext_lazy as _
from urllib.parse import urlencode
from urllib.request import urlopen
from django.core.urlresolvers import reverse
from django.conf import settings as project_settings
from .base import BackendBase
class PaypalBackend(Backe... | {
"repo_name": "CCrypto/ccvpn3",
"path": "payments/backends/paypal.py",
"copies": "1",
"size": "7659",
"license": "mit",
"hash": -2213259307502332000,
"line_mean": 35.4714285714,
"line_max": 90,
"alpha_frac": 0.5742264003,
"autogenerated": false,
"ratio": 3.9745718733783084,
"config_test": true,... |
from django.shortcuts import redirect
from django.views.decorators.http import require_http_methods
from rest_registration.api.views.register import (
process_verify_registration_data
)
from rest_registration.api.views.register_email import (
process_verify_email_data
)
from rest_registration.api.views.reset_p... | {
"repo_name": "szopu/django-rest-registration",
"path": "rest_registration/contrib/verification_redirects/views.py",
"copies": "1",
"size": "1838",
"license": "mit",
"hash": 5560823734428683000,
"line_mean": 31.8214285714,
"line_max": 71,
"alpha_frac": 0.6974972797,
"autogenerated": false,
"ratio... |
from django.shortcuts import redirect
from django.views.defaults import page_not_found
from website.project.model import User
from website.mailchimp_utils import subscribe_on_confirm
from admin.base.views import GuidFormView, GuidView
from admin.users.templatetags.user_extras import reverse_user
from .serializers imp... | {
"repo_name": "billyhunt/osf.io",
"path": "admin/users/views.py",
"copies": "1",
"size": "1263",
"license": "apache-2.0",
"hash": -8533196104876577000,
"line_mean": 24.26,
"line_max": 61,
"alpha_frac": 0.7078384798,
"autogenerated": false,
"ratio": 3.5779036827195467,
"config_test": false,
"h... |
from django.shortcuts import redirect
from django.views.generic.base import TemplateView
from django.http import Http404
from django.core.urlresolvers import reverse
from wkhtmltopdf.views import PDFResponse
from wkhtmltopdf.utils import wkhtmltopdf
from scorecard.profiles import get_profile
from scorecard.models impo... | {
"repo_name": "Code4SA/municipal-data",
"path": "scorecard/views.py",
"copies": "1",
"size": "4816",
"license": "mit",
"hash": -9203872123997361000,
"line_mean": 33.4,
"line_max": 98,
"alpha_frac": 0.5903239203,
"autogenerated": false,
"ratio": 3.7160493827160495,
"config_test": false,
"has_n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.