Opened 12 years ago
Closed 12 years ago
#20350 closed Bug (invalid)
Unable to edit and save data in database
Reported by: | anonymous | Owned by: | nobody |
---|---|---|---|
Component: | Python 2 | Version: | 1.3 |
Severity: | Normal | Keywords: | django |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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
Change History (2)
comment:1 by , 12 years ago
Type: | Uncategorized → Bug |
---|
comment:2 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
You haven't told us what the actual problem is, and this doesn't look like the place to get help: TicketClosingReasons/UseSupportChannels