Sort states and substates by their ID in the model.

Use the right number of hyphens to separate the current ADs from
old ADs in the I-D Search form.
 - Legacy-Id: 374
This commit is contained in:
Bill Fenner 2007-06-13 17:23:38 +00:00
parent 2ad2219895
commit ada5521a9f
2 changed files with 3 additions and 1 deletions

View file

@ -12,7 +12,7 @@ class IDSearch(forms.Form):
search_rfcnumber = forms.CharField(widget=forms.TextInput(attrs={'size': 5, 'maxlength': 60})) search_rfcnumber = forms.CharField(widget=forms.TextInput(attrs={'size': 5, 'maxlength': 60}))
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(IDSearch, self).__init__(*args, **kwargs) super(IDSearch, self).__init__(*args, **kwargs)
self.fields['search_job_owner'].choices = [('', '--All/Any')] + [(ad.id, "%s, %s" % (ad.last_name, ad.first_name)) for ad in IESGLogin.objects.filter(user_level=1).order_by('last_name')] + [('-99', '----------')] + [(ad.id, "%s, %s" % (ad.last_name, ad.first_name)) for ad in IESGLogin.objects.filter(user_level=2).order_by('last_name')] self.fields['search_job_owner'].choices = [('', '--All/Any')] + [(ad.id, "%s, %s" % (ad.last_name, ad.first_name)) for ad in IESGLogin.objects.filter(user_level=1).order_by('last_name')] + [('-99', '------------------')] + [(ad.id, "%s, %s" % (ad.last_name, ad.first_name)) for ad in IESGLogin.objects.filter(user_level=2).order_by('last_name')]
class EmailFeedback(forms.Form): class EmailFeedback(forms.Form):
category = forms.CharField(widget=forms.HiddenInput()) category = forms.CharField(widget=forms.HiddenInput())

View file

@ -40,6 +40,7 @@ class IDState(models.Model):
choices = staticmethod(choices) choices = staticmethod(choices)
class Meta: class Meta:
db_table = 'ref_doc_states_new' db_table = 'ref_doc_states_new'
ordering = ['document_state_id']
class Admin: class Admin:
pass pass
@ -62,6 +63,7 @@ class IDSubState(models.Model):
return self.sub_state return self.sub_state
class Meta: class Meta:
db_table = 'sub_state' db_table = 'sub_state'
ordering = ['sub_state_id']
class Admin: class Admin:
pass pass