So I have this model forms:
User = get_user_model()
class UserRegisterForm(forms.ModelForm):
username = forms.CharField(label='', widget=forms.TextInput(attrs={'placeholder': 'Username'}))
email = forms.EmailField(label='', widget=forms.TextInput(attrs={'placeholder': 'Email Address'}))
email2 = forms.EmailField(label='', widget=forms.TextInput(attrs={'placeholder': 'Confirm Email'}))
password = forms.CharField(label='', widget=forms.PasswordInput(attrs={'placeholder': 'Password'}))
avatar = forms.ImageField(upload_to='profile_images')
class Meta:
model = User
fields = [
'username',
'email',
'email2',
'password'
]
But this appear
TypeError: __init__() got an unexpected keyword argument 'upload_to'
The problem is that I think it will works if I add the ImageField object to the model, but I dont have a model, As you can see I am using the get_user_model(), is there a way to use upload_to in model forms, or how can I add to the default 'get_user_model' the ImageField object?