On Mon, Jan 18, 2016 at 12:03:00PM +1100, sum abiut wrote: > Hi, > i am having some trouble with my date picker. I probably missing someting, > the form fields are displaying fine, but some how the datepicker is no > displaying. probably something to do with my jquery. Please help
Could you perhaps go more into detail? Do you want to have a date picker widget on both DateFields, or only one of them? Does the date picker appear on one of them, but not the other, or does it appear on neither? What does the final rendered HTML look like? (Just the relevant parts.) > models.py > class foreginexchange(models.Model): > Sold_deal_number=models.CharField(max_length=45) > Value_date=models.DateField() > Vatu_equivalent=models.CharField(max_length=45) > Instructions=models.TextField() > Done_Date=models.DateField() > Booked=( > ('Tonny Garae','Tonny Garae'), > ('Fredric Jacob','Fredric Jacob'), > ) > Worked_By=models.CharField(max_length=45,choices=Worked) > > def __unicode__(self): > return self.Sold_deal_number > > > form.py > > from django import forms > > from foregin_exchange.models import foreginexchange > > class foregin_exchange_form(forms.ModelForm): > class Meta: > model =foreginexchange > widgets = {'Value_date': > forms.DateInput(attrs={'class':'datepicker'}),} > widgets={'Done_Date':forms.DateInput(attrs={'class':'datepicker'}),} This here looks wrong. The first assignment to “widgets” would set the class for “Value_date”, and the following assignment throws the previous setting away and replaces it with a setting for “Done_Date”. If the problem is that the date picker works for “Done_Date”, but not “Value_date”, then this is the problem. You're probably looking for something like:: widgets = { 'Value_date': forms.DateInput(attrs={'class': 'datepicker'}), 'Done_Date': forms.DateInput(attrs={'class':' datepicker'}), } Regards, Michal -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20160118082931.GY20308%40koniiiik.org. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: Digital signature