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…
Tag: django
About (sender, instance, created, **kwargs) parameter. How it’s assigned
I’m new to python in general and while I was going through a tutorial it teaches about signals. I’ve been trying to figured how this function works, as in how (sender, instance, created, **kwargs) is assigned to? I can’t seem to wrap my head around it. So if a post is saved it triggers this …
Django migrations error: dont create authomatically permissions and contenttypes
I work with django 1.8.7 and python 2.7 . I have peoblem with migrate. when I migrate my models , permission and contenttypes don’t create automatically. error looks like this: and when I change migrations file like this: and run command ” python manage.py migrate ” this is responsed: thanks…
Django: ‘str’ object has no attribute ‘get’
I am trying to effectively make a Reddit clone just for practice with Django and I am trying to set up my upvote/downvote system with just a simple integer(upvote adds one, downvotes subtract one) however when I hit my “upvote” or “downvote” buttons it gives me the error ‘strR…
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.Foreig…
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 kno…
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 p…
Django REST authentication not working with React
actually I want: if a user is authenticated: then create/get the Cart with user, else: create/get the Cart with session key. But at first problem happened with authentication. At first I tried to register the user and saved the key(got from drf) in local storage. in Reactjs: I think no problem here. if I cons…
Django 2.2 cannot serialize default values once migration has been done
I have a model which is refered to as a foreignkey with on_delete set to SET_DEFAULT. Because of that, I need to provide this model with a default item. I created a static method which does just that. I am able to run makemigrations and migrate without issue. My problem starts when I modifiy my models and try…
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 implem…