Python Forum

Full Version: error accessing data
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Error:
Class 'CRUD' has no 'objects' member [E1101]
class CRUDList(ListView):
    model = CRUD

    def get_queryset(self):
        result = super(CRUDList, self).get_queryset()
        category = self.request.GET.get('category')
        if category:
            if self.request.GET:
                if self.request.GET.get('asc'):
                    [color=#D35400]result = CRUD.objects.order_by(category)[/color]
                elif self.request.GET.get('desc'):
                   [color=#D35400][/color]result = CRUD.objects.order_by('-'+category)[/color]

        return result
Whatever CRUD is, it doesn't have an objects property. You're getting an error for trying to use something that doesn't exist.

If you think that's not right, you'll have to give a whole lot information, such as what a CRUD is.