Nettoyage de code
Essentiellement, suppression d'import inutilisés.
This commit is contained in:
parent
0caaf88a78
commit
3229441cb7
14 changed files with 8 additions and 48 deletions
|
@ -1,7 +1,6 @@
|
|||
# coding: utf-8
|
||||
|
||||
from django.core.mail import send_mail
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
|
||||
from django.contrib import admin
|
||||
from django.db.models import Sum, Count
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
from __future__ import division
|
||||
|
||||
from django.conf import settings
|
||||
from django.db.models import Max
|
||||
|
||||
import random
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from django import forms
|
||||
from django.forms.models import BaseInlineFormSet
|
||||
from bda.models import Spectacle, Participant, ChoixSpectacle, Attribution
|
||||
from bda.models import Spectacle
|
||||
|
||||
class BaseBdaFormSet(BaseInlineFormSet):
|
||||
def clean(self):
|
||||
|
|
|
@ -5,7 +5,6 @@ import calendar
|
|||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.db.models.signals import post_save
|
||||
|
||||
class Tirage(models.Model):
|
||||
title = models.CharField("Titre", max_length=300)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from django.conf.urls import include, url, patterns
|
||||
from bda import views
|
||||
from django.conf.urls import url, patterns
|
||||
from bda.views import SpectacleListView
|
||||
|
||||
urlpatterns = patterns('',
|
||||
|
|
16
bda/views.py
16
bda/views.py
|
@ -2,11 +2,9 @@
|
|||
|
||||
from __future__ import division
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.db import models
|
||||
from django.http import Http404
|
||||
from django.core import serializers
|
||||
from django.forms.models import inlineformset_factory
|
||||
import hashlib
|
||||
|
@ -19,7 +17,6 @@ from datetime import timedelta
|
|||
import time
|
||||
|
||||
from gestioncof.decorators import cof_required, buro_required
|
||||
from gestioncof.shared import send_custom_mail
|
||||
from bda.models import Spectacle, Participant, ChoixSpectacle, Attribution, Tirage
|
||||
from bda.algorithm import Algorithm
|
||||
|
||||
|
@ -120,7 +117,6 @@ def places_ics(request, tirage_id):
|
|||
places_dict[place.spectacle] = place
|
||||
spectacles.append(place.spectacle)
|
||||
filtered_places.append(place)
|
||||
date = place.spectacle.date.date()
|
||||
return render(request, "resume_places.ics",
|
||||
{"participant": participant,
|
||||
"places": filtered_places}, content_type="text/calendar")
|
||||
|
@ -264,18 +260,6 @@ def do_resell(request, form):
|
|||
spectacle = form.cleaned_data["spectacle"]
|
||||
count = form.cleaned_data["count"]
|
||||
places = "2 places" if count == "2" else "une place"
|
||||
"""
|
||||
send_custom_mail("bda-revente@lists.ens.fr",
|
||||
"bda-revente",
|
||||
{"places": places,
|
||||
"spectacle": spectacle.title,
|
||||
"date": spectacle.date_no_seconds(),
|
||||
"lieu": spectacle.location,
|
||||
"prix": spectacle.price,
|
||||
"revendeur": request.user.get_full_name(),
|
||||
"revendeur_mail": request.user.email},
|
||||
from_email = request.user.email)
|
||||
"""
|
||||
mail = u"""Bonjour,
|
||||
|
||||
Je souhaite revendre %s pour %s le %s (%s) à %.02f€.
|
||||
|
|
|
@ -7,10 +7,7 @@ from django.contrib.auth.models import User
|
|||
from django.contrib.auth.admin import UserAdmin
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.safestring import mark_safe
|
||||
import django.forms as forms
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.contrib.admin import SimpleListFilter
|
||||
from django.db.models import Q
|
||||
|
||||
def add_link_field(target_model = '', field = '', link_text = unicode, desc_text = unicode):
|
||||
def add_link(cls):
|
||||
|
|
|
@ -2,7 +2,6 @@ import csv
|
|||
from django.http import HttpResponse, HttpResponseForbidden
|
||||
from django.template.defaultfilters import slugify
|
||||
from django.apps import apps
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
def export(qs, fields=None):
|
||||
model = qs.model
|
||||
|
@ -40,16 +39,6 @@ def admin_list_export(request, model_name, app_label, queryset=None, fields=None
|
|||
if not queryset:
|
||||
model = apps.get_model(app_label, model_name)
|
||||
queryset = model.objects.all()
|
||||
filters = dict()
|
||||
"""
|
||||
for key, value in request.GET.items():
|
||||
if key not in ('ot', 'o'):
|
||||
filters[str(key)] = str(value)
|
||||
if len(filters):
|
||||
queryset = queryset.filter(**filters)
|
||||
"""
|
||||
#qs2 = User.objects.filter(profile__eav__a_vot = True)
|
||||
#queryset = queryset.filter(pk__in = qs2.values_list('id', flat = True))
|
||||
queryset = queryset.filter(profile__is_cof = True)
|
||||
if not fields:
|
||||
if list_display and len(queryset.model._meta.admin.list_display) > 1:
|
||||
|
|
|
@ -4,10 +4,11 @@ from django import forms
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.contrib.auth.models import User
|
||||
from django.forms.widgets import RadioSelect, CheckboxSelectMultiple
|
||||
from django.db.models import Max
|
||||
|
||||
from gestioncof.models import CofProfile, EventCommentValue
|
||||
from gestioncof.widgets import TriStateCheckbox
|
||||
from gestioncof.shared import lock_table, unlock_table, send_custom_mail
|
||||
from gestioncof.shared import lock_table, unlock_table
|
||||
|
||||
class EventForm(forms.Form):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -82,7 +83,6 @@ class SurveyStatusFilterForm(forms.Form):
|
|||
def __init__(self, *args, **kwargs):
|
||||
survey = kwargs.pop("survey")
|
||||
super(SurveyStatusFilterForm, self).__init__(*args, **kwargs)
|
||||
answers = {}
|
||||
for question in survey.questions.all():
|
||||
for answer in question.answers.all():
|
||||
name = "question_%d_answer_%d" % (question.id, answer.id)
|
||||
|
@ -242,7 +242,6 @@ class AdminEventForm(forms.Form):
|
|||
kwargs["initial"] = {"status":"no"}
|
||||
super(AdminEventForm, self).__init__(*args, **kwargs)
|
||||
choices = {}
|
||||
comments = {}
|
||||
for choice in current_choices:
|
||||
if choice.event_option.id not in choices:
|
||||
choices[choice.event_option.id] = [choice.id]
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.db.models.signals import post_save
|
||||
|
||||
def choices_length (choices):
|
||||
return reduce (lambda m, choice: max (m, len (choice[0])), choices, 0)
|
||||
|
|
|
@ -15,7 +15,7 @@ from django.conf import settings
|
|||
from django.contrib.auth.decorators import login_required
|
||||
from django.db.models import Min
|
||||
|
||||
from gestioncof.models import CofProfile, Clipper
|
||||
from gestioncof.models import CofProfile
|
||||
from gestioncof.petits_cours_models import *
|
||||
from gestioncof.decorators import buro_required
|
||||
from gestioncof.shared import lock_table, unlock_tables
|
||||
|
|
|
@ -4,7 +4,7 @@ from django_cas_ng.backends import CASBackend
|
|||
from django_cas_ng.utils import get_cas_client
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.models import User as DjangoUser
|
||||
from django.db import models, connection
|
||||
from django.db import connection
|
||||
from django.core.mail import send_mail
|
||||
from django.template import Template, Context
|
||||
|
||||
|
|
|
@ -4,9 +4,7 @@ import unicodecsv
|
|||
|
||||
from django.shortcuts import redirect, get_object_or_404, render
|
||||
from django.http import Http404, HttpResponse
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.db.models import Max
|
||||
from django.contrib.auth.views import login as django_login_view
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
|
@ -15,15 +13,13 @@ from gestioncof.models import Event, EventRegistration, EventOption, EventOption
|
|||
from gestioncof.models import EventCommentField, EventCommentValue
|
||||
from gestioncof.shared import send_custom_mail
|
||||
from gestioncof.models import CofProfile, Clipper
|
||||
from gestioncof.decorators import buro_required, cof_required
|
||||
from gestioncof.decorators import buro_required
|
||||
from gestioncof.forms import UserProfileForm, EventStatusFilterForm, \
|
||||
SurveyForm, SurveyStatusFilterForm, RegistrationUserForm, \
|
||||
RegistrationProfileForm, AdminEventForm, EventForm
|
||||
|
||||
from bda.models import Tirage
|
||||
|
||||
import re
|
||||
|
||||
@login_required
|
||||
def home(request):
|
||||
data = {"surveys": Survey.objects.filter(old=False).all(),
|
||||
|
|
|
@ -8,7 +8,7 @@ if __name__ == "__main__":
|
|||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cof.settings")
|
||||
from django.conf import settings
|
||||
settings.DEBUG = True
|
||||
from bda.models import Spectacle, Participant, ChoixSpectacle, Attribution
|
||||
from bda.models import Spectacle, Participant, ChoixSpectacle
|
||||
from bda.algorithm import Algorithm
|
||||
from django.db.models import Sum
|
||||
from django.db import connection
|
||||
|
|
Loading…
Reference in a new issue