Skip to content
Advertisement

Tag: django-models

module ‘qrcode’ has no attribute ‘make’

While integrating python library qrcode==6.1 with django==3.1.2. I have been trying to generate a qrcode which will contain the URL links for my other websites. Models.py But It always display an error saying that module ‘qrcode’ doesnot contain any attribute named ‘make()’. I want to know how to resolve this? Answer Make sure there are not any files named qrcode.py

Django Query Multi Table

I’m trying to do a form query on a field and the goal is to get all the kids enrolled in all the teachers classes in this drop down menu. The query I have right now is getting all the classes a teacher is enrolled in . However how do I retrieve the kids within those classes. I attached a

Django rest framework’s StringRelatedField is throwing KeyError

I have the following model classes. and I have imported these classes as following as they are located in a separate package and this is my serializer class and views is and url has the following I am getting the following error I looked into the DRF example and this seems to be a simple thing to achieve. https://www.django-rest-framework.org/api-guide/relations/#api-reference But

Django ModelForm has no model class specified, Although model in Meta class is set to a model

Error is “ModelForm has no model class specified.” forms.py code models.py code views.py code The error is occurs when I’m trying to create a new user form (user_form = UserForm()). Although in my meta class I set models to the User model imported from django.contrib.auth.models. Error Info Picture Answer I think your spellings in your forms are wrong could you

Django: def save() in models.py

I’m trying to add the save-function inside my models.py, but it seems I’m doing something wrong. The user has to type the first- and last-name. Without him or her entering any more data, another field inside my models.py should be filled with a combination from these fields. models.py: Is this even possible? Thanks for all your help. Have a nice

How to fix TemplatesDoesNotExist error even after BASE_DIR has been Joined with templates in settings.py?

Image 1- Error I notice Exception Value: registration/login.html , I don’t even have that in the templates, instead, i have sign-in.html, I have no idea why it mentioned login.html. Please see my templates folder below as image 3-Templates. I’m trying to fix the above error. My project path looks like Image 2- project path Image 3- Templates The image 2

Advertisement