Reformatting only (PEP8)

This commit is contained in:
Peter Bittner 2014-05-31 18:09:27 +02:00
parent 0194290140
commit e894b14a96
6 changed files with 210 additions and 255 deletions

View file

@ -1,11 +1,10 @@
from django.db import models
from django import forms
from django.forms import ModelForm
from django.contrib.auth.models import User,Group
from django.contrib.auth.models import User, Group
from todo.models import Item, List
import datetime
class AddListForm(ModelForm):
class AddListForm(ModelForm):
# The picklist showing allowable groups to which a new list can be added
# determines which groups the user belongs to. This queries the form object
# to derive that list.
@ -15,11 +14,9 @@ class AddListForm(ModelForm):
class Meta:
model = List
class AddItemForm(ModelForm):
# The picklist showing the users to which a new task can be assigned
# must find other members of the groups the current list belongs to.
def __init__(self, task_list, *args, **kwargs):
@ -27,57 +24,51 @@ class AddItemForm(ModelForm):
# print dir(self.fields['list'])
# print self.fields['list'].initial
self.fields['assigned_to'].queryset = User.objects.filter(groups__in=[task_list.group])
due_date = forms.DateField(
required=False,
widget=forms.DateTimeInput(attrs={'class':'due_date_picker'})
)
required=False,
widget=forms.DateTimeInput(attrs={'class': 'due_date_picker'})
)
title = forms.CharField(
widget=forms.widgets.TextInput(attrs={'size':35})
)
widget=forms.widgets.TextInput(attrs={'size': 35})
)
class Meta:
model = Item
class EditItemForm(ModelForm):
# The picklist showing the users to which a new task can be assigned
# must find other members of the groups the current list belongs to.
def __init__(self, *args, **kwargs):
def __init__(self, *args, **kwargs):
super(EditItemForm, self).__init__(*args, **kwargs)
self.fields['assigned_to'].queryset = User.objects.filter(groups__in=[self.instance.list.group])
class Meta:
model = Item
exclude = ('created_date','created_by',)
exclude = ('created_date', 'created_by',)
class AddExternalItemForm(ModelForm):
"""Form to allow users who are not part of the GTD system to file a ticket."""
title = forms.CharField(
widget=forms.widgets.TextInput(attrs={'size':35})
)
note = forms.CharField (
widget=forms.widgets.TextInput(attrs={'size': 35})
)
note = forms.CharField(
widget=forms.widgets.Textarea(),
help_text='Foo',
)
)
class Meta:
model = Item
exclude = ('list','created_date','due_date','created_by','assigned_to',)
exclude = ('list', 'created_date', 'due_date', 'created_by', 'assigned_to',)
class SearchForm(ModelForm):
"""Search."""
q = forms.CharField(
widget=forms.widgets.TextInput(attrs={'size':35})
)
widget=forms.widgets.TextInput(attrs={'size': 35})
)