I have created the form
this is my views.py.
def newdata(request):
if request.method == "POST":
MyDataform = Dataform(request.POST)
if MyDataform.is_valid():
MyDataform.save()
results = machinelist.objects.all()
#result = data.objects.all()
return redirect('/', {'data': results})
else:
MyDataform=Dataform()
results = machinelist.objects.all()
result = insert.objects.all()
return redirect('/',{'data': results},{'record':result})
else:
results = machinelist.objects.all()
result = insert.objects.all()
return redirect('/', {'data': results},{'record':result})
This is my forms.py
class Dataform(forms.ModelForm):
class Meta:
model = insert
fields = "__all__"
Regard,
Neha Bhurke
Precise Industrial Solutions Private Limited
Mob: +91 7738946067 I O: +91 22 28943214
Add: 115, 1st Floor, Hari Om Plaza, Behind Omkareshwar Mandir, Near National Park, Borivali (E), Mumbai-400066
On Tue, Feb 23, 2021 at 12:35 PM Danny <dannywahyudi351@gmail.com> wrote:
Maybe it is not related to the model definition, but rather the .save() object?--On Tuesday, February 23, 2021 at 1:52:04 PM UTC+7 bhurk...@gmail.com wrote:I have done all these codes but it is saving only the current date .Any other methodRegard,Neha BhurkePrecise Industrial Solutions Private Limited
Mob: +91 7738946067 I O: +91 22 28943214
Add: 115, 1st Floor, Hari Om Plaza, Behind Omkareshwar Mandir, Near National Park, Borivali (E), Mumbai-400066
On Tue, Feb 23, 2021 at 12:10 PM Omkar Parab <omkar...@gmail.com> wrote:datetime=models.DateTimeField(auto_now=False) ?Or remove "auto_now"datetime=models.DateTimeField()--On Tue, Feb 23, 2021, 11:34 AM neha bhurke <bhurk...@gmail.com> wrote:Hello everyone,I am trying to select the custom date but datetime=models.DateTimeField(auto_now=True)is only taking current date ....Please help me--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b1c53101-c7c6-403f-9b43-6713d7f66c07n%40googlegroups.com.
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...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJY8mfxi-bxtyMVWiOWCESK969Ok6nZaoyhWNSLvFO_0tEGp1Q%40mail.gmail.com.
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c98c61c4-f767-4917-88e2-aed03c91c7can%40googlegroups.com.
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEwf5Q2ZhT%2BSPP%2BQrEy-8VYswxNqSE5FmTX-%2BPR6H_bMXw-bAw%40mail.gmail.com.
No comments:
Post a Comment