/ / कैसे प्लेसहोल्डर जोड़ने के लिए और django में एक साथ फ़ील्ड लेबल बदलें? - अजगर, डीजेंगो, डीजेंगो-फॉर्म, डीजेंगो-टेम्प्लेट

प्लेसहोल्डर को जोड़ने और django में एक साथ फॉर्म फ़ील्ड लेबल को कैसे बदलें? - अजगर, django, django- रूपों, django-टेम्पलेट्स

मैं django में फ़ील्ड लेबल को बदलने की कोशिश कर रहा हूँफ़ॉर्म और एक स्थान धारक को जोड़ना चाहते हैं, लेकिन जब मैं एक प्लेसहोल्डर विशेषता सेट करता हूं, तो फ़ील्ड लेबल doesn "t काम करता है और" Bio "के बजाय डिफ़ॉल्ट फ़ील्ड लेबल" work_or_study "दिखाता है। यहाँ कोड है:

class ProfileEditForm(forms.ModelForm):
date_of_birth=forms.CharField(widget=forms.TextInput(attrs={"placeholder":"y-m-d"}))
work_or_study=forms.CharField(widget=forms.TextInput(attrs={"placeholder":"something interesting about you"}))
class Meta:
model= Profile
labels = {"work_or_study":"Bio"}
fields = ("date_of_birth","work_or_study")

उत्तर:

जवाब के लिए 0 № 1

लेबल को ठीक करने के लिए इसे बदलें

work_or_study=forms.CharField(widget=forms.TextInput(attrs={"placeholder":"something interesting about you"}))

सेवा मेरे

work_or_study=forms.CharField(label="Bio", widget=forms.TextInput(attrs={"placeholder":"something interesting about you"}))

और मेटा में लेबल सूची हटाएं