I want to write an inventory manager. i written a django app before and in the first app everything works fine, but now i got a problem. when i try to render the template i get the error:
- ModelForm has no model class specified -
i looked up some forums and here in stack overflow was a guy with the same error, but he did only a typo. i checked my code threetimes, everything should be correct...
my model:
class Device (models.Model):
inventory_number = models.IntegerField()
device_name = models.CharField(max_length=64)
is_used = models.BooleanField()
user = models.ForeignKey(User, blank=True)
manufacturer = models.ForeignKey(Manufacturer, blank=True)
vendor = models.ForeignKey(Vendor, blank=True)
note = models.TextField(blank=True)
purchase_date = models.DateField(blank=True)
def __unicode__(self):
return self.id
my modelform :
class DeviceForm(ModelForm):
class Metal:
model = Device
my view:
def create_device(request):
if request.method == 'POST':
device_form = DeviceForm(request.POST)
if device_form.is_valid():
device_form.save()
return HttpResponseRedirect ('/Inventory/')
device_form = DeviceForm()
c = RequestContext (request,{
'device_form' : device_form
})
return render_to_response('create_device.html', c)
my template:
Inventar erfassen
the imports are correct... i rly don't know where i can find the fault thank u for help