myAPP имя является каталогом
У меня есть модели в models.py:
class Sale(models.Model):
good = models.ForeignKey ("Good", help_text = 'Select good', on_delete = models.SET_NULL, null = True)
quantitysales = models.IntegerField (default=1, help_text = 'Enter Qty')
datesales = models.DateField (null = True, blank = True)
storename = models.ForeignKey ("Store", help_text = 'Select store', on_delete = models.SET_NULL, null = True)
views.py Я пытаюсь сделать один рисунок c для веб-страницы
def sales_filter(request):
with connection.cursor() as cursor:
cursor.execute('''
select datesales, alcohol, confections
from catalog_Sale
where datesales = %s,
order by datesales;
''', ('2020-04-10',))
dt = np.array([ ( (x), float (y), float (z) ) for (x, y, z) in cursor ])
fig, ax = plt.subplots()
tm = np.array(dt[:,0])
alcohol = np.array([ x for x in accumulate(dt[:,1]) ])
confections = np.array([ x for x in accumulate(dt[:,2]) ])
ax.plot(tm,alcohol)
ax.plot(tm,confections)
#Generate image grafic
buf = io.BytesIO()
fig.savefig(buf,format='PNG')
return HttpResponse( buf.getvalue(), content_type='image/png')
В моем коде eror Значение исключения:
возле ",": синтаксическая ошибка, и я не знаю, верен ли мой код, мне нужна помощь, пожалуйста !!!