views.py 797 Bytes
Newer Older
1
2
3
4
5
6
from django.shortcuts import render
from django.views.generic.edit import UpdateView, CreateView
from django import forms
from django.forms import Select
from django.conf import settings

7
from subscription.models import Member, Subscription
8
9
10
11
12
13
14
15
16
17
18
19
from core.views import CanEditMixin, CanEditPropMixin, CanViewMixin

class SubscriptionForm(forms.ModelForm):
    class Meta:
        model = Subscription
        fields = ['subscription_type', 'payment_method']
        #widgets = {
        #    'subscription_type': Select(choices={(k.lower(), k+" - "+str(v['price'])+"€"+str(Subscription.compute_end(2))) for k,v in settings.AE_SUBSCRIPTIONS.items()}),
        #}


class NewSubscription(CanEditMixin, CreateView):
20
    template_name = 'subscription/subscription.html'
21
    form_class = SubscriptionForm