Change team form widget base from Select to TextInput to avoid loading all related values from the database. Fixes #13
This commit is contained in:
parent
c2195f22ae
commit
63c542d20f
1 changed files with 4 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
from django.utils.safestring import mark_safe
|
||||
from django.forms import ModelForm, Field
|
||||
from django.forms.widgets import Select, Media
|
||||
from django.forms.widgets import TextInput, Select, Media
|
||||
from .models.profiles import Team
|
||||
from .models.events import Event
|
||||
|
||||
|
@ -21,8 +21,8 @@ $(document).ready(function(){
|
|||
});
|
||||
</script>''')
|
||||
|
||||
class Lookup(Select):
|
||||
input_type = 'select'
|
||||
class Lookup(TextInput):
|
||||
input_type = 'text'
|
||||
template_name = 'forms/widgets/lookup.html'
|
||||
add_id_index = False
|
||||
checked_attribute = {'selected': True}
|
||||
|
@ -56,6 +56,7 @@ class NewTeamForm(ModelForm):
|
|||
'spr': Lookup(source='/api/spr/', label='name'),
|
||||
'city': Lookup(source='/api/cities/', label='name'),
|
||||
}
|
||||
raw_id_fields = ('country','spr','city')
|
||||
|
||||
class TeamEventForm(ModelForm):
|
||||
class Meta:
|
||||
|
|
Loading…
Reference in a new issue