78 lines
2.2 KiB
Python
78 lines
2.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
Copyright (c) 2015-2016 by Martin Bley (martin@mb-oss.de)
|
|
|
|
This file is part of TipPy.
|
|
|
|
TipPy is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
TipPy is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with TipPy. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
"""
|
|
from django import forms
|
|
from django.forms import ModelForm
|
|
from django.contrib.auth.models import User
|
|
from django.core.files.images import get_image_dimensions
|
|
from tipp.models import Match, Competition, Post, UserProfile, \
|
|
Mandant, RelUserMandant
|
|
|
|
class NumberInput(forms.TextInput):
|
|
input_type = 'number'
|
|
|
|
class TippForm(forms.Form):
|
|
tippTeam1 = forms.IntegerField(required=True,widget=NumberInput(
|
|
attrs={
|
|
'cols': '2',
|
|
'min': '0', 'max': '99', 'step': '1',
|
|
'class':'form-inline',
|
|
'role': 'form'
|
|
}
|
|
))
|
|
tippTeam2 = forms.IntegerField(required=True,widget=NumberInput(
|
|
attrs={
|
|
'cols': '2',
|
|
'min': '0', 'max': '99', 'step': '1',
|
|
'class':'form-inline',
|
|
'role': 'form'
|
|
}
|
|
))
|
|
tippTeam1.widget.attrs['style'] = "width:45px"
|
|
tippTeam2.widget.attrs['style'] = "width:45px"
|
|
|
|
class BlogpostForm(ModelForm):
|
|
class Meta:
|
|
model = Post
|
|
fields = ['content']
|
|
|
|
class MandantsForm(forms.Form):
|
|
mandants = forms.MultipleChoiceField(
|
|
label= "Posten in ",
|
|
widget=forms.CheckboxSelectMultiple({'checked':'checked'})
|
|
)
|
|
|
|
class UserForm(forms.ModelForm):
|
|
class Meta:
|
|
model = User
|
|
fields = ['email', 'first_name', 'last_name']
|
|
|
|
class UserProfileForm(forms.ModelForm):
|
|
class Meta:
|
|
model = UserProfile
|
|
fields = ['avatar']
|
|
|
|
class LeagueImportForm(forms.Form):
|
|
leagues = forms.ChoiceField(
|
|
widget=forms.RadioSelect()
|
|
)
|
|
|
|
|