Questions tagged [django-1.11]

Django 1.11 is a version of the Django framework, released April 2017. It is a Long Term Support (LTS) release, and will be supported until at least April 2020. Please only use this tag if your question relates specifically to this version.

Django 1.11 requires Python 3.4, 3.5, or 3.6. It is the last version of Django to support Python 2.

Here are some of the salient features of Django 1.11:

Django-1.11 was released in April 2017 as a long-term support release and will be supported until April 2020.

324 questions
22
votes
2 answers

Database indexes in Django 1.11: difference between db_true, indexes and index_together

Django 1.11 offers new ways to create database indexes. So far we had db_index=True in each field: # example 1 class Person(models.Model): name = models.CharField(db_index=True) age = models.IntegerField(db_index=True) Now we have…
cuducos
  • 730
  • 6
  • 17
19
votes
3 answers

Using Multiple Databases with django

I have to use multiple databases in my project but there is a problem. Model can't see intended database accounts.db. when i go localhost:port/admin/app/accounts it says me no such table: accounts. Model is looking for default database not…
mtalha
  • 396
  • 1
  • 3
  • 11
18
votes
6 answers

ALLOWED_HOSTS and Django

I tried to launch a Django 1.11 project on production server. When I start the app I see the following error: Invalid HTTP_HOST header: 'bla-bla-bla.bla-bla-vla.com'. You may need to add u'bla-bla-bla.bla-bla-vla.com' to ALLOWED_HOSTS** But, host…
Alex
  • 685
  • 3
  • 9
  • 20
16
votes
2 answers

Using ModelFormMixin without the 'fields' attribute is prohibited

I'm using Django 1.11 I have created a Form and using Class based view to create a record and save to database. Business/models.py class BusinessType(models.Model): title = models.CharField(max_length=100) created =…
Anuj TBE
  • 9,198
  • 27
  • 136
  • 285
16
votes
3 answers

Admin inline with no ForeignKey relation

Is it possible to manually specify the set of related object to show in an inline, where no foreign key relation exists? # Parent class Diary(models.Model): day = models.DateField() activities = models.TextField() # Child class…
Flash
  • 15,945
  • 13
  • 70
  • 98
15
votes
1 answer

Django template keyword `choice_value` in no longer work in 1.11

There is a multiple checkbox in template, if value contain in render the choice will checked by default. It works well with 1.10. form.py: class NewForm(forms.Form): project = forms.ModelMultipleChoiceField( …
fen
  • 1,109
  • 9
  • 25
14
votes
5 answers

Localization: django-admin compilemessages skip venv

I am using localization in Django 1.11 application. I can exclude the virtual environment folder and node_modules folder while adding the messages in message file using -i option like: django-admin makemessages -l 'no' -i venv django-admin…
arshovon
  • 13,270
  • 9
  • 51
  • 69
13
votes
3 answers

How to send file to response in Django?

I have such php function which I try to rewrite in my Django project. What should be an analogue in python for php methods like header() and show_error()? Also how to send file to response? php: function waprfile($date=false) { if(!isset($date)…
Nurzhan Nogerbek
  • 4,806
  • 16
  • 87
  • 193
11
votes
1 answer

Django subquery throws "more than one row returned by a subquery used as an expression"

I have recently upgraded to django 1.11 and I want to use the newly released, Subquery exrpession feature. There are two models as follows class Project(models.Model): title = models.CharField(_("Project Name"), max_length=128) class…
sajid
  • 807
  • 1
  • 9
  • 23
9
votes
1 answer

How to use memcached in Django?

I've seen all over problems using Memcached in Django projects which is considered to be The fastest, most efficient type of cache supported natively by Django For instances, Why doesn't memcache work in my Django? How to configure Memcache for…
Tiago Martins Peres
  • 14,289
  • 18
  • 86
  • 145
9
votes
2 answers

How to upgrade django project multiple versions (1.8 to 1.11+)?

I'm upgrading an old project running on Django 1.8 to at least Django 1.11 for LTS. I've heard upgrading a django project multiple versions can be difficult and frustrating. I haven't done this, so my question; is it better to do an upgrade per…
Vincent
  • 1,494
  • 12
  • 26
7
votes
2 answers

Django assertRedirects test fails due to http://testserver prefix

I want to test that /sitemap.xml/ redirects to /sitemap.xml. I'm using this code: res = self.client.get('/sitemap.xml/') self.assertRedirects(res, '/sitemap.xml', status_code=301) And getting the following error: AssertionError: Response redirected…
akxlr
  • 1,142
  • 9
  • 23
6
votes
1 answer

Creating a custom django logging handler. 'module' object has no attribute 'handlers'

I'm attempting to create a class based logging handler which notifies some third party service when the app sees a DisallowedHost exception using some of the built in logging configurations provided by django. However, I'm getting a particular…
rob
  • 2,119
  • 1
  • 22
  • 41
6
votes
2 answers

ModuleNotFoundError: No module named 'debug_toolbar'

In trying to make the migrations with python manage.py runserver, I got the following traceback : Traceback (most recent call last): File "manage.py", line 22, in execute_from_command_line(sys.argv) File…
dave
  • 93
  • 2
  • 10
6
votes
2 answers

Django: DetailView implementing a get_queryset()

I'm getting this following error: ImproperlyConfigured at /elearning/7447932a-6044-498a-b902-97cbdd0a4001/ DetailView is missing a QuerySet. Define DetailView.model, DetailView.queryset, or override DetailView.get_queryset(). Following the Django…
Papouche Guinslyzinho
  • 5,277
  • 14
  • 58
  • 101
1
2 3
21 22