Skip to content

Tag: django-views

AttributeError: ‘tuple’ object has no attribute ‘model’. How to fix this error?

I’m new to Django. Please help me to solve this error. I’m not getting any solution. I tried many stackoverflow solutions and GitHub solutions but I’m not getting where the error is coming from. Exception log Here is the github link of the app – Django I tried many stackoverflow solutions but I am not understanding

Direct assignment to the forward side of a many-to-many set is prohibited. Use coolbox_id.set() instead. helpme

I am getting this error when i use many to many field help me plsssssss I’ve been stuck here for 3 days now. At first I used it as a CharField so I could add it, but when I added another ID it couldn’t add it. It says there is a problem in this part ship_id_max = shipping.objects.aggregate(Max(‘shipping_id’))[‘ship_id__max’]

List View is not working but get_context_data() works

I have a ListView but when I call it only the get_context_data method works (the news and category model, not the product) when I try to display the information of the models in the templates. view: There is also this piece of code: context = super().get_context_data(**kwargs) If it’s written before: categories = Category.objects.all() The Product model is show but not

Django Rest API from Database

I have 2 APIs from my existing project. Where One provides the latest blog posts and another one provides sorting details. The 2nd API (sorting) gives blog posts ID and an ordering number, which should be in the 1st,2nd,3rd…n position. If I filter in the first API with that given ID I can get the blog post details. How can

Automatic avoidance of category duplicates

I have the problem with Category Model. I have 2 tables: so they are standard models with categories. User can create Category by creating a movie with the name of category additionaly. The problem is when user is trying to create Movie with category name that already exists, because it will create another category with the same name (like duplicate)