Unverified Commit bfa2c852 authored by Marco Marinello's avatar Marco Marinello
Browse files

Introduce a created_by field for other hardware. refs #659

WARNING: this update requires a clean other hardware db
parent d4858ffe
......@@ -323,6 +323,7 @@ class OtherHardware(models.Model):
# MySQL has a TINYINT(4). Django stores BooleanFields as TINYINT when the
# DB doesn't have a BOOLEAN type (like MySQL). For now I use a BooleanField
# with default=False, which seems plausible.
created_by = models.ForeignKey(User, verbose_name=_("Created by"))
dismissed = models.BooleanField(default=False)
class Meta:
......
......@@ -185,6 +185,7 @@ def create_other_hardware(request, id):
if otherhardwareform.is_valid():
other_hardware = otherhardwareform.save(commit=False)
other_hardware.school = school
other_hardware.created_by = request.user
other_hardware.save()
return HttpResponseRedirect(reverse('school_detail', args=[school.id,])+"#otherhardware")
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment