Answer the question
In order to leave comments, you need to log in
How to handle data from model in views?
class QuantityComponent(models.Model): #подсчитанные компоненты к прибору
part_number = models.ForeignKey(Component, on_delete=models.CASCADE)
quantity = models.IntegerField('quantity', null=True, blank=True)
def multiple(self):
summ = self.quantity * 5
return summ
def countspecification(request, device, multiple):
context = {}
quantityGroupComponentsForDevice = QuantityComponent.objects.filter(groupcomponents__name__contains = device)
context['result'] = quantityGroupComponentsForDevice
return render(request, "groupcomponents.html", context)
self.quantity
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question