Django错误'ManagerDescriptor'对象没有属性'filter'

时间:2019-11-18 01:09:03

标签: django django-models django-views

我是django的新手,在检索视图“ dashboard”时遇到错误“ ManagerDescriptor”对象没有属性“ filter”的情况-以下是我的视图和模型。有人可以在这里指出正确的方向吗?谢谢!

#views.py

def dashboard(request):
    tabledata_totals = ''
    if not request.user.is_authenticated:
        return redirect(settings.LOGIN_URL, request.path)
    else:
        orgs = Profile.objects.values_list('assigned_org_ids', 'view_group').get(user_id=request.user.id)
        tabledata_totals = org_totals.objects.filter(org_id__in=orgs[0].split(',')).aggregate(
            sum('open_supplement_count'),
            sum('open_estimate_count'),
            sum('open_measurement_count'),
            sum('total_open_count'),
            sum('supplement_sent_to_ins'),
            sum('revised_scope_received_additional_items_needed'),
            sum('homeowner_permission_needed'),
            sum('three_calls_to_adjuster_without_response'),
            sum('spoke_to_adjuster'),
            sum('missing_documents_required_for_supplementation'),
            sum('wWaiting_on_a_revised_scope'),
            sum('estimate_created_and_sent_to_customer'),
            sum('deal_in'),
            sum('supplement_complete'),
            sum('eagleview_measurements'),
            sum('confirmed_received'),
            sum('confirmed_assigned_to_adjuster'),
            sum('additional_documentation_needed')
            )
    return render(request, 'HTML/dashboard.html', {'data': tabledata_totals})

#models.py

@login_required(login_url='/login/')
class org_totals(models.Model):
    organization = models.CharField(max_length=100, blank=True, null=True)
    org_id = models.SmallIntegerField(primary_key=True)
    open_supplement_count = models.SmallIntegerField(blank=True, null=True)
    open_estimate_count = models.SmallIntegerField(blank=True, null=True)
    open_measurement_count = models.SmallIntegerField(blank=True, null=True)
    total_open_count = models.SmallIntegerField(blank=True, null=True)
    Supplement_Sent_to_Ins = models.SmallIntegerField(blank=True, null=True)
    Revised_Scope_Received_Additional_Items_Needed = models.SmallIntegerField(blank=True, null=True)
    Homeowner_Permission_Needed = models.SmallIntegerField(blank=True, null=True)
    three_Calls_to_Adjuster_Without_Response = models.SmallIntegerField(blank=True, null=True)
    Spoke_to_Adjuster = models.SmallIntegerField(blank=True, null=True)
    Missing_Documents_Required_for_Supplementation = models.SmallIntegerField(blank=True, null=True)
    Waiting_on_a_Revised_Scope = models.SmallIntegerField(blank=True, null=True)
    Estimate_Created_and_Sent_to_Customer = models.SmallIntegerField(blank=True, null=True)
    Deal_In = models.SmallIntegerField(blank=True, null=True)
    Supplement_Complete = models.SmallIntegerField(blank=True, null=True)
    Eagleview_Measurements = models.SmallIntegerField(blank=True, null=True)
    Confirmed_Received = models.SmallIntegerField(blank=True, null=True)
    Confirmed_Assigned_to_Adjuster = models.SmallIntegerField(blank=True, null=True)
    Additional_Documentation_Needed = models.SmallIntegerField(blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'org_open_totals'

0 个答案:

没有答案