Enlève eav-django qui n'est plus utilisé

Fixes #5.
This commit is contained in:
Basile Clement 2016-05-26 21:47:15 +02:00
parent 498fa2809b
commit 01891bfd6c
4 changed files with 0 additions and 109 deletions

View file

@ -44,7 +44,6 @@ INSTALLED_APPS = (
'bda2', 'bda2',
'bda3', 'bda3',
'autocomplete_light', 'autocomplete_light',
'eav',
'captcha', 'captcha',
'debug_toolbar', 'debug_toolbar',
) )

View file

@ -8,7 +8,6 @@ from django.contrib.auth.admin import UserAdmin
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
import django.forms as forms import django.forms as forms
#import eav.admin
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.contrib.admin import SimpleListFilter from django.contrib.admin import SimpleListFilter
from django.db.models import Q from django.db.models import Q
@ -69,9 +68,6 @@ class EventAdmin(admin.ModelAdmin):
EventCommentFieldInline, EventCommentFieldInline,
] ]
#from eav.forms import BaseDynamicEntityForm
#class CofProfileInline(eav.admin.BaseEntityInline, admin.StackedInline):
class CofProfileInline(admin.StackedInline): class CofProfileInline(admin.StackedInline):
model = CofProfile model = CofProfile
#form = BaseDynamicEntityForm #form = BaseDynamicEntityForm
@ -149,91 +145,6 @@ class EventRegistrationAdmin(admin.ModelAdmin):
list_filter = ('paid',) list_filter = ('paid',)
search_fields = ('user__username', 'user__first_name', 'user__last_name', 'user__email', 'event__title') search_fields = ('user__username', 'user__first_name', 'user__last_name', 'user__email', 'event__title')
"""
class VoterProfileInlineForm(BaseDynamicEntityForm):
def __init__(self, data=None, *args, **kwargs):
super(BaseDynamicEntityForm, self).__init__(data, *args, **kwargs)
config_cls = self.instance._eav_config_cls
self.entity = getattr(self.instance, config_cls.eav_attr)
self.base_fields = {}
self._build_dynamic_fields()
class VoterProfileInline(eav.admin.BaseEntityInline, admin.StackedInline):
model = CofProfile
form = VoterProfileInlineForm
inline_classes = ("collapse open",)
fields = None
fieldsets = None
def get_fieldsets(self, request, obj=None):
formset = self.get_formset(request)
fk_name = self.fk_name or formset.fk.name
kw = {fk_name: obj} if obj else {}
instance = self.model(**kw)
form = formset.form(request.POST, instance=instance)
return [(None, {'fields': form.fields.keys()})]
class VotedListFilter(SimpleListFilter):
# Human-readable title which will be displayed in the
# right admin sidebar just above the filter options.
title = _(u'A voté')
# Parameter for the filter that will be used in the URL query.
parameter_name = 'voted'
def lookups(self, request, model_admin):
return (
('1', _('Yes')),
('0', _('No')),
)
def queryset(self, request, queryset):
# Returns the filtered queryset based on the value
# provided in the query string and retrievable via
# `self.value()`.
#
# Compare the requested value (either '80s' or '90s')
# to decide how to filter the queryset.
if self.value() == '1':
qs2 = User.objects.filter(profile__eav__a_vot = True)
return queryset.filter(pk__in = qs2.values_list('id', flat = True))
return voters
if self.value() == '0':
qs2 = User.objects.filter(profile__eav__a_vot = False)
return queryset.filter(pk__in = qs2.values_list('id', flat = True))
class VoterAdmin(UserProfileAdmin):
form = forms.ModelForm
fields = ('username','first_name','last_name')
readonly_fields = ('username','first_name','last_name')
fieldsets = None
def is_cof(self, obj):
try:
return obj.profile.is_cof
except CofProfile.DoesNotExist:
return False
is_cof.short_description = 'Membre du COF'
is_cof.boolean = True
def a_vote(self, obj):
try:
if not obj.profile.eav.a_vot:
return False
else:
return True
except CofProfile.DoesNotExist:
return False
a_vote.short_description = 'A voté'
a_vote.boolean = True
list_display = ('profile_num',) + UserAdmin.list_display + ('is_cof','a_vote')
list_filter = ('profile__is_cof', 'profile__is_buro', VotedListFilter)
inlines = [
VoterProfileInline,
]
"""
class PetitCoursAbilityAdmin(admin.ModelAdmin): class PetitCoursAbilityAdmin(admin.ModelAdmin):
list_display = ('user','matiere','niveau','agrege') list_display = ('user','matiere','niveau','agrege')
search_fields = ('user__username', 'user__first_name', 'user__last_name', 'user__email', 'matiere__name', 'niveau') search_fields = ('user__username', 'user__first_name', 'user__last_name', 'user__email', 'matiere__name', 'niveau')
@ -265,5 +176,4 @@ admin.site.register(PetitCoursAbility, PetitCoursAbilityAdmin)
admin.site.register(PetitCoursAttribution, PetitCoursAttributionAdmin) admin.site.register(PetitCoursAttribution, PetitCoursAttributionAdmin)
admin.site.register(PetitCoursAttributionCounter, PetitCoursAttributionCounterAdmin) admin.site.register(PetitCoursAttributionCounter, PetitCoursAttributionCounterAdmin)
admin.site.register(PetitCoursDemande, PetitCoursDemandeAdmin) admin.site.register(PetitCoursDemande, PetitCoursDemandeAdmin)
#admin.site.register(Voter, VoterAdmin)
admin.site.register(EventRegistration, EventRegistrationAdmin) admin.site.register(EventRegistration, EventRegistrationAdmin)

View file

@ -198,20 +198,3 @@ class SurveyAnswer(models.Model):
class Clipper(models.Model): class Clipper(models.Model):
username = models.CharField("Identifiant", max_length = 20) username = models.CharField("Identifiant", max_length = 20)
fullname = models.CharField("Nom complet", max_length = 200) fullname = models.CharField("Nom complet", max_length = 200)
"""
class Voter(User):
class Meta:
proxy = True
verbose_name = "voteur"
def __unicode__(self):
return u"%s %s" % (self.first_name, self.last_name)
import eav
eav.register(CofProfile)
class ManagerOnlyEavConfig(eav.registry.EavConfig):
manager_only = True
eav.register(User, ManagerOnlyEavConfig)
"""

View file

@ -5,7 +5,6 @@ django-autoslug==1.8.0
-e hg+https://bitbucket.org/cpcc/django-cas@47d19f3a871fa744dabe884758f90fff6ba135d5#egg=django_cas -e hg+https://bitbucket.org/cpcc/django-cas@47d19f3a871fa744dabe884758f90fff6ba135d5#egg=django_cas
django-grappelli==2.6.5 django-grappelli==2.6.5
django-recaptcha==1.0.5 django-recaptcha==1.0.5
eav-django==1.4.7
MySQL-python==1.2.5 MySQL-python==1.2.5
Pillow==2.9.0 Pillow==2.9.0
simplejson==3.8.2 simplejson==3.8.2