hi,

i want to make a custom form in admin.py for modify the form of a model 
that should show a combobox with all urlpattern name defined in urls.py.

I tryed with this code (i'm a python/django newbie, sorry ;)):

def fasullo():
    pass

class NameURLForm(forms.ModelForm):
    class Meta:
        model = NameURL
        fields = ['nameStart', 'nameEnd']
    def clean_date(self):
        pass
    def __init__(self, *args, **kwargs):
        super(NameURLForm, self).__init__(*args, **kwargs)

        listURL = []
        for name, L in get_resolver(None).reverse_dict.items():
            if type(name) != type(fasullo):
                if name != None and name != "":
                    listURL.append(name)
        self.fields['nameStart'] = forms.ChoiceField(choices=listURL)
        self.fields['nameEnd'] = forms.CharField(label="nameEnd", 
max_length=80,required=True,
                                                
 widget=forms.Select(choices=[(i,listURL[i]) for i in range(len(listURL))]))


any hint?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/03e8c082-d38b-4e83-a63b-b66f5d3c82cd%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to