在我的 ShowChart 中有一个名为 Electronic(Electronic.objects.values..etc) 的模型,在我的继承类(ChartElectrical) 中,它需要更改为 Electrical (Electronic.objects.values..etc),这里我只是传递它。我不知道该怎么做
class ShowChart(View):
def get(self, request):
my_count = Electrical.objects.values('allocated_time')\
.annotate(complete=Count('allocated_time', filter=Q(batch_18=True)),
not_complete=Count('allocated_time',
filter=Q(batch_18=False)),
complete_1=Count('allocated_time',
filter=Q(batch_19=True)),
not_complete_1=Count('allocated_time',
filter=Q(batch_19=False)),
complete_2=Count('allocated_time',
filter=Q(batch_20=True)),
not_complete_2=Count('allocated_time',
filter=Q(batch_20=False)),
complete_3=Count('allocated_time',
filter=Q(batch_21=True)),
not_complete_3=Count('allocated_time',
filter=Q(batch_21=False)))
c_batch_18 = list()
n_batch_18 = list()
c_batch_19 = list()
n_batch_19 = list()
c_batch_20 = list()
n_batch_20 = list()
c_batch_21 = list()
n_batch_21 = list()
for entry in my_count:
c_batch_18.append(entry['complete'] * entry['allocated_time'])
n_batch_18.append(entry['not_complete'] * entry['allocated_time'])
c_batch_19.append(entry['complete_1'] * entry['allocated_time'])
n_batch_19.append(entry['not_complete_1'] * entry['allocated_time'])
c_batch_20.append(entry['complete_2'] * entry['allocated_time'])
n_batch_20.append(entry['not_complete_2'] * entry['allocated_time'])
c_batch_21.append(entry['complete_3'] * entry['allocated_time'])
n_batch_21.append(entry['not_complete_3'] * entry['allocated_time'])
MMTTMM
相关分类