it's action not url ,
it's a dummy of my model

Regards
Chander Shekhar
(bestcsp)


On Mon, Jul 13, 2020 at 11:37 PM chander shekhar <bestc...@gmail.com> wrote:

> #forms.py
>
> class eventform(forms.ModelForm):
>
>
>
>     class Meta:
>
>         model = Event
>
>         fields = [, 'end_time',]
>
>         widgets = {
>
>     'start_time':  forms.DateTimeInput(attrs={'type': 'datetime-local'}),
>
>
>
> Models.py
>
> class Event(models.Model):
>
>     title = models.CharField(max_length=200)
>
>     description = models.TextField()
>
>     start_time = models.DateTimeField()
>
>  views.py
>
> def add(request):
>
>     if request.method=='POST':
>
>
>
>
>
>         form=eventform(request.POST)
>
>         if form.is_valid():
>
>             form.save()
>
>             return redirect('calendar')
>
>         else:
>
>             messages.error(request, "Error")
>
>             return render(request,'event/add.html',{'form':form})
>
> template
>
> <form  method='POST' method={% url 'add' %}>
>
>     {% csrf_token %}
>
>
>
>         {{form.as_p}}
>
>
>
>      <button class='btn btn-outline-info' type="submit">ADD</button>
>
>
>
>     </form>
>
> </div>
> Regards
> Chander Shekhar
> (bestcsp)
>
>
> On Mon, Jul 13, 2020 at 8:18 PM coolguy <cooldjangoprogram...@gmail.com>
> wrote:
>
>> Please share your model, view and template for more clarity. Thanks
>>
>> On Sunday, July 12, 2020 at 9:25:16 AM UTC-4, Chander shekhar wrote:
>>>
>>>
>>> On Sun, Jul 12, 2020, 6:37 PM Kasper Laudrup <lau...@stacktrace.dk>
>>> wrote:
>>>
>>>> On July 12, 2020 3:02:00 PM GMT+02:00, Chander shekhar <
>>>> best...@gmail.com> wrote:
>>>> >starttime=datetimefield()
>>>> >
>>>> >i want to take datetimefield from my template but i am not able to do
>>>> >it.
>>>> >i have created the form and passed the widget of datetime-local but it
>>>> >is
>>>> >not acceptable ,it is giving me error .
>>>> >Help me to resolve it .
>>>> >It's important
>>>>
>>>> It will be a lot easier for people to help you if you share which kind
>>>> of error you are getting.
>>>>
>>>> Kind regards,
>>>>
>>>> Kasper Laudrup
>>>>
>>>> --
>>>> 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...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/7D0D33A0-8A01-48F7-9928-A8465CC40066%40stacktrace.dk
>>>> .
>>>>
>>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/a485f092-32df-42c4-a25b-dc6f1696bbdbo%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/a485f092-32df-42c4-a25b-dc6f1696bbdbo%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAmOWVwB56mQUBxdysN7AuXvrS_cFxXvheYb9TMjmJrmKHYATg%40mail.gmail.com.

Reply via email to