简体   繁体   中英

How can I render Django Form with vuetify?

In our regular Django form we can render the form with something like this {{form.username}} and we specify the widget within the constructor of the form class like name, class, id, label, etc.

Now suppose that I have this form class

class LoginForm(forms.Form):
    email = forms.EmailField(widget=forms.EmailInput())
    password = forms.CharField(widget=forms.PasswordInput())
    
    class Meta:
        fields = ['email', 'password']
    
    def __init__(self, *args, **kwargs):
        super(LoginForm, self).__init__(*args, **kwargs)
        self.fields['email'].required = True
        self.fields['password'].required = True

How can I render it with vuetify components in template?

# example 
<v-text-field label="username"></v-text-field>
<v-select></v-select>
# something like that

Thanks you

寻找完全相同的东西,我不知道你是否设法实现了你想要的,或者是否有人得到了一些提示。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM