Category "django"

Django model fields not appearing in admin

I have a relatively simple model in my Django project (I should note that the wording is weird in that the app itself is called 'games' and within it the model

Django custom model Interger extrafield not saving in the database return None instead

my models class UserManager(BaseUserManager): def create_user(self, email, password=None, **extra_fields): print(phone_number, 'phone_number')

Django: Non-primary Foreign Key object can't access related model instance

I'm new in Django. I have 2 class tech_system adn equiptment in models.py class tech_system(models.Model): id_tech_system = models.BigAutoField(db_column='I

How to Fix "django channels", Failed to build cryptography?

I try to install Django channels and I get this error how to fix it? =============================DEBUG ASSISTANCE============================= If you are s

How to get all objects referenced as ForeignKey from given field in a module in django

I have two classes: Author and Book. I want class Authors to have an attribute that contains all books written by the said author, as referenced to as foreign k

Django cannot find my media folder while debug = False

I have a django project that works very well and shows all media files uploaded from the admin when debug = True but immediately i turn change to debug = False

RexProScriptException transaction is not open in Django with Titan (graph DB)

I am stuck with my TitanDB, Django1.8 and Mogwai0.7.7 package. I have Graph database titan/cassandra on localhost dev machine, and after creating wrong queries

Django superuser doesn't have permission to delete models

I am working on upgrading a Django website from Django 1.8 to Django 2.2 and have come across a problem when trying to delete an object from the Django admin ch

How to manually customize parameters of DRF views using drf-yasg Swagger?

I am using drf-yasg package to integrate Swagger with DRF. As documentation said I used @swagger_auto_schema decorator to manually customize auto-generated endp

Displaying child records based on parent id from URL

I have one model Dataset and another one called DatasetReview, where DatasetReview has a foreign key connection to Dataset. I would like to display all of the D

Django ModuleNotFoundError

I can't make a simple Django project work at all. I get the same error as listed in this question which I found: Python/Django =- ModuleNotFoundError: No modul

How to Crop Images in a Django Application *JavaScript Issue*

I am having issues with my JavaScript code, and I am trying to get the image crop (picture) below to pop up but when I click the Choose File button but nothing

'ProgrammingError: function avg(character varying) does not exist' - Django project

I have recently deployed a Django project to Heroku. While testing out the functionality in the browser, I've come across a new error when attempting to render

Rendering a string in django template as json object

I have a angular app that sends json data to a django backend. The django app save the json data in to a DB and later pulls it out to send it back to the angula

Check if user has a permission with specific codename in django

I am trying to check if a user has a permission, which I have defined in the class Meta of the model, with a specific codename. At the moment I have: if reques

How to add username to the filefield?

I am making use of file fields in my model and I want it to be saved as username_field.jpeg (or whatever format it is in), for example for rent_agreement I want

How to POST multiple objects in one JSON request?

I am using django-rest-framework and recently I encountered a problem. I need to post such request and get 2 objects created: { "lease": 28, "date": [

Django async testing: Cannot operate on a closed database

I was following this tutorial on testdriven.io in order to test some async functions in django and I need to add som decorators in order to enable my async test

django 'str' object has no attribute '_meta'

Sorry for my English. I have some data from another server, but I need to output this data like JSON. if i print response in console: { 'responseStatus': {

Mongoengine raw find_and_modify query gives "Must either update or remove" exception

I am using Django + mongoengine I want to update the books (embedded document) count in my Bookscollection document. I want the update query to return the full