urls.py は
(r'^when/$', 'when'),
(r'^media/$', 'media'),
(r'^followup/$', 'followup'),
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')
manual_date_time = models.DateTimeField('Another time', null=True, blank=True)
sent_date_time = models.DateTimeField('Sent')
views.py は
def when(request):
if request.method == 'POST':
reportform = ReportForm(data=request.POST)
if reportform.is_valid():
log.debug("test:%s",reportform)
report = reportform.save(commit=False)
report.user = request.user
redirect_to = request.POST.get('next',
reverse('media')
)
return HttpResponseRedirect(media)
else:
pass
else:
reportform = ReportForm()
return render_to_response('incident/when.html',{
'newreport_menu': True,
'form': reportform,
},
context_instance=RequestContext(request))
以下のエラーが表示されます」
NoReverseMatch at /member/when/
Reverse for 'media' with arguments '()' and keyword arguments '{}' not found."
views.py の次の行に
redirect_to = request.POST.get('next',
reverse('media')
)
テンプレートは
<form action="/member/when/" method="POST"> {% csrf_token %}
{{ form.manual_date_time }}
<p id=ir-nextbutn><a href="{% url incident.views.media %}">
{% include "buttons/next.html" %}</form>
AttributeError at /member/when/
'function' object has no attribute 'find'