class PhotographerInfo(models.Model): profile_page=models.ForeignKey(Profile, related_name='photoinfo', on_delete=models.CASCADE) name=models.CharField(max_length = 255) company_name=models.CharField(max_length =255) email=models.EmailField() phone_number=PhoneNumberField() country=CountryField() def __str__(self): return str(self.profile_page, self.name) def get_absolute_url(self): return reverse('Welcome') class Photographer(CreateView): model = PhotographerInfo template_name='photo.html' #fields='__all__' form_class=PhotographerInfoForm class PhotographerInfoForm(forms.ModelForm): class Meta: model = PhotographerInfo fields=['profile_page','name','company_name','email','phone_number','country'] widgets={ #'profile_page':forms.Select(attrs={'class':'form-control'}), 'profile_page':forms.TextInput(attrs={'class':'form-control', 'value':'','id':'user','type':'hidden'}), 'name':forms.TextInput(attrs={'class':'form-control'}), 'company_name':forms.TextInput(attrs={'class':'form-control'}), 'email':forms.EmailInput(attrs={'class':'form-control'}), 'phone_number':forms.TextInput(attrs={'class':'form-control'}), 'country':CountrySelectWidget(), }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)