Skip to content
Advertisement

Tag: django

Django oscar – customizing StockRecordForm form

I am trying to customize StockRecordForm in django-oscar administration. What I have: Forked dashboard app, also catalogue_dashboard Included new StockRecord attribute in models.py Updated forms.py like this: Part of my INSTALLED_APPS looks like this: But modification is not showing up. Is there anything else I should modify? Answer Allright, I am surprised that in this case I have to actually

Unable to save into Foreign key fields in Django with multiple table

I’m working on a project Hr Management System. I have a model with foreign key fields to office & staff. I’m trying to save staff in user & staff role wise with foreign key office name. my view My models Answer We can remove (id) from Models since it auto-implemented office = models.ForeignKey(Office,on_delete=models.DO_NOTHING) Assign user staffs office to office like

TypeError at /api/questions/ ‘list’ object is not callable

When I go to this http://127.0.0.1:8000/api/questions/ I get TypeError at /api/questions/ ‘list’ object is not callable urls.py (in project) urls.py (in appName1/api views.py (in appName1/api) Only showing QuestionViewSet From the settings.py Error could come from somewhere else. I don’t know where I can find “list”. appName1 = questions Exception Location: lib/python3.9/site-packages/rest_framework/generics.py, line 162, in paginator Answer The DEFAULT_PAGINATION_CLASS setting should

How to use If else in queryset in django

I need to use if else condition for Value1 in my queryset..I have found average for my records in the queryset..I need to apply condition like..If my Value1 is between 90 and 110 then I have to get message as “great” and if its below 90 it must print as “low” and if above 140 it must print as “high”

Pending request on Django

I’m building a website using Django. I have the register and login sessions working, so any user can create an account and login. But now I want a situation whereby when someone creates an account, the account will be inactive and pending until the admin accepts the user. However, I haven’t implemented any code that does that before and I

Advertisement