Initial commit
This commit is contained in:
40
tipp/forms.py
Normal file
40
tipp/forms.py
Normal file
@@ -0,0 +1,40 @@
|
||||
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']
|
||||
|
||||
Reference in New Issue
Block a user