On 31/03/2017 7:55 AM, sum abiut wrote:
>
>
> Hi,
> i am trying to use django admin datepicker on my custom form to have
> it show on two fields but when i run the app it only showing on one
> field, the start_date but not showing on end_date. can some please
> point me to the right direction.
What happens if you leave the widget option out altogether?
>
> here is my quote.
>
> models.py
>
> class stafleave(models.Model):
> first_name=models.CharField(max_length=45)
> last_name=models.CharField(max_length=45)
> leave_type=models.CharField(max_length=45,choices=leave)
> start_date=models.DateField()
> end_date=models.DateField()
> Total_working_Hours=models.IntegerField()
> username =models.ForeignKey(User
>
>
> forms.py
>
> class leaveform(forms.ModelForm):
> start_date = forms.DateField(widget=widgets.AdminDateWidget)
> end_date = forms.DateField(widget=widgets.AdminDateWidget)
>
> class Meta:
> model=stafleave
>
>
>
>
> template.html
>
> <html>
>
>
> <head>
>
>
> <!-- Datepicker-->
>
>
> <script type="text/javascript" src="/admin/jsi18n/"></script>
>
> <script type="text/javascript" src="/static/admin/js/core.js"></script>
>
> <script type="text/javascript"
> src="/admin_media/js/admin/RelatedObjectLookups.js"></script>
> {{ form.media }}
>
>
> <!--End Datepicker--
>
>
> </head>
>
> <body>
>
>
> <form action="" method="post">{%csrf_token%}
> <table>
> {{form.as_table}}
>
> </table>
> <br>
> <input type="submit" name="submit" value="Apply for Leave" >
>
>
> </form>
> </div>
>
>
>
> </body>
>
> </html>
>
> --
> 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+unsubscribe@googlegroups.com
> <mailto:django-users+unsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto: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/CAPCf-y7PRbbmbM%2BuSSWS7hjBqziDBWRusv7GsmikjqU%2B5hzMuw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPCf-y7PRbbmbM%2BuSSWS7hjBqziDBWRusv7GsmikjqU%2B5hzMuw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
--
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+unsubscribe@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/360739fe-879f-8763-d000-ef77ac7ee141%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment