Category "django"

How to resolve "django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: foo" in Django 1.7?

On upgrading to Django 1.7 I'm getting the following error message from ./manage.py $ ./manage.py Traceback (most recent call last): File "./manage.py", lin

Django-admin: show multi select field for JSONField

I have a model with a field channel (JSONField). I'm strong an array of string in db with channel. By default, a JSONField is shown as a textarea in django-admi

Django queryset TruncMonth output format issue

I'm using Django ORM queryset for chart, and having difficulty with changing the format of output 'source': ActivityLog.objects.filter(requestType='add',doDat

Differences between STATICFILES_DIR, STATIC_ROOT and MEDIA_ROOT

What are the differences of these three static url? I am not sure if I am right, I am using the MEDIA_ROOT to store my uploaded photos (via models.ImageField(

(13: Permission denied) while connecting to upstream:[nginx]

I am working with configuring Django project with Nginx and Gunicorn. While I am accessing my port gunicorn mysite.wsgi:application --bind=127.0.0.1:8001 in Ng

Does Django cache related ForeignKey and ManyToManyField fields once they're accessed?

Given the following model, does Django cache the related objects after the first time they're accessed? class Post(models.Model): authors = models.ManyToMa

Django check_token(user, token) fails in view but works in test/shell_plus?

Getting the strangest behavior. This fails in normal Django code (view): user = User.objects.get(...) uid = urlsafe_base64_encode(force_bytes(user.pk)) token =

How to add custom views or overide views for Django Admin index?

urls.py -> ''''from django.contrib import admin from django.urls import path from Administrator import views admin.site.index_template = 'admi

How can I change charset and collation with Django's migrations?

I have a character field that's utf8 I want it to be utf8mb4, how do I accomplish that with Django's migrations?

How to listen to already existing SQS queue with Celery and Django?

I want to listen to an existing SQS queue through Celery. I have already done publishing to Queue via celery and then consuming from that queue through workers

Display last page of paginated results instead of 404 using ListView

The Django docs show how to return the last page of a paginated queryset using a function-based view by catching the EmptyPage exception. What's the easiest wa

Django- jQuery AJAX POST response- trouble parsing JSON

I'm using an app that allows me to post forms responses, from an html template, asynchronously. I've verified that my POST works fine, but I'm having trouble wi

Fetch Data from DB in base template Django Python

I am developing an application (simple online store) with Python Django I have created a base.html file in templates and then all other html files extends from

Getting a JSON request in a view (using Django)

I am trying to set up a view to received a JSON notification from an API. I'm trying to figure out how to get the JSON data, and I currently have this as a star

Getting Error with django - Field 'id' expected a number but got '{}'

I'm coding a book store and on the single product page above the title of the book I have a link that directs the customer to the author profile page. The link

Django, show ValidationError in template

I create a registation app, where users can register providing a username, email and a password. What I did is make sure that the email field is unique(as you c

ImportError : cannot import name 'ugettext_lazy'

I'm trying to install suit, I entered this command : pip install https://github.com/darklow/django-suit/tarball/v2 and wrote this code : from suit.apps import D

Why can't I add a ManyToMany relation to an object in Django?

I've got an api made in Django which has two models linked by a ManyToMany relation. class Type(models.Model): name = models.CharField(max_length=64) ap

Change a Django form field to a hidden field

I have a Django form with a RegexField, which is very similar to a normal text input field. In my view, under certain conditions I want to hide it from the use

'choices' must be an iterable containing (actual value, human readable name) tuples

Having an error when trying to set choices on model field. Here's the code: TICKET = 'TICKET', TICKET_HISTORY = 'TH' TICKET_RATE = 'TR' PASSWORD_CHANGE = 'PASS