#20350: Unable to edit and save data in database
-------------------------------+--------------------
     Reporter:  anonymous      |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Python 2       |    Version:  1.3
     Severity:  Normal         |   Keywords:  django
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 models.py
 class Report(models.Model):
     user = models.ForeignKey(User, null=False)
     incident_number = models.CharField('Incident Number', max_length=100)
     device_id = models.CharField('Device Id', max_length=100)
     app_uuid = models.CharField('Unique App Id', max_length=100)
     created_date_time = models.DateTimeField('Created',auto_now=True)
     manual_date = models.DateField('manual date', null=True, blank=True)
     manual_time = models.TimeField('manual time',null=True, blank=True)

 views.py

 def when(request,pk=id):

     if request.method == 'POST':

         reportform = ReportForm(data=request.POST)

         if reportform.is_valid():
             log.debug("test:%s",reportform)
             report = Report.objects.get(pk=id)
             reportform=ReportForm(instance=report)
             report = reportform.save(commit=False)
             report.user = request.user
             report.save()
             return redirect('/member/media/')
     else:
         report=Report.objects.get(pk=id)
         reportform = ReportForm(instance=report)
     return render_to_response('incident/when.html',{
                   'newreport_menu': True,
                   'form': reportform,
                    },
                    context_instance=RequestContext(request))

 urls.py

 (r'^when/(?P<id>\w+)/$', 'when'),

 I am not able to edit and update the data in database,How to solve this.

 Thnaks

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20350>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to