Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Python
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(),


		}


What I have tried:

i tried to print it in my template but i failed
Posted
Updated 10-Jun-21 3:49am
v2
Comments
Richard MacCutchan 10-Jun-21 8:55am    
Explain what you tried and what happened. We are not very good at guessing what happens on your system.
michael samson 2021 10-Jun-21 9:44am    
Ok! thank you I want to print those information from the model to the profile page of the photographer so that customers can know the details of the photographer. but i don't know how to print them by using DTL( Django Template Language)
Richard MacCutchan 10-Jun-21 9:49am    
There is not space here to teach you something like that; see the link below.
michael samson 2021 10-Jun-21 10:43am    
Where is the link please
Richard MacCutchan 10-Jun-21 10:48am    
Right under your nose.

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900