41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
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
|
|
|
|
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:35px"
|
|
tippTeam2.widget.attrs['style'] = "width:35px"
|
|
|
|
class BlogpostForm(ModelForm):
|
|
class Meta:
|
|
model = Post
|
|
fields = ['title', 'content']
|
|
|
|
class UserForm(forms.ModelForm):
|
|
class Meta:
|
|
model = User
|
|
fields = ['email', 'first_name', 'last_name']
|
|
|
|
class UserProfileForm(forms.ModelForm):
|
|
class Meta:
|
|
model = UserProfile
|
|
fields = ['avatar']
|
|
|