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
2
votes
1 answer

How to prevent FactoryBoy from reusing object of a SubFactory?

I have the following factories: class UserFactory(factory.DjangoModelFactory): class Meta: model = get_user_model() class ProProfileFactory(factory.DjangoModelFactory): user = factory.SubFactory(UserFactory) class Meta: …
haki
  • 9,389
  • 15
  • 62
  • 110
2
votes
1 answer

Django disabled field with initial data raises validation errors

I have a field in my form that is given an initial data and disabled if a user is staff (admin can choose from a list). I have this field disabled for staff with the code line below. self.fields[''].disabled = True After uprading to django 1.11.7…
2
votes
0 answers

Django 1.11 enter_transaction_management alternative

We are using django as our main backend, we use django-nose as our unit test framework. We have recently upgraded from django 1.3 to 1.11, a huge change, we are facing the following issue. When we are django 1.3, the unit tests ran fine, but with…
2
votes
0 answers

How can I automatically save in django-admin editable listviews (or popup a reminder) on leave

Problem I have a question on how to save in editable listviews in the django-admin. I use django 1.11 with python 3.6. Suppose I have a list of 100-200 Events in a model. In order to bulk edit a boolean field for all entries, I register the model…
uweremer
  • 21
  • 2
2
votes
1 answer

prevent SQL injection in django forms

I use this for validation: class MyValidationForm(forms.Form): title = forms.CharField() body = forms.Textarea() taxonomy = forms.IntegerField() and this is my class-based view: class blog_createpost(dashboardBaseViews): template_name =…
Iman Salehi
  • 908
  • 2
  • 14
  • 34
2
votes
0 answers

Django manually render form fields instead of form.as_p

I'm using Django 1.11 I have a CreateView with inlineformset to store associated model record. forms.py class BusinessForm(ModelForm): class Meta: model = Business exclude = () BusinessAddressFormSet = inlineformset_factory( …
Anuj TBE
  • 9,198
  • 27
  • 136
  • 285
2
votes
0 answers

dictionary update sequence element #0 has length 1; 2 is required. Error during template rendering

This question has been asked before, but the answer given doesn't seem to work for me... I have: ValueError at /myapp/ dictionary update sequence element #0 has length 1; 2 is required Error during template rendering In template…
pymat
  • 1,090
  • 1
  • 23
  • 45
2
votes
3 answers

How fix error in unit test? | AssertionError

I am trying to write unit-test to my create function in Django project. This is my first experience creating of unit-tests. Why I cant create new data? From error I understand that there is no articles in test database. Where I did…
Nurzhan Nogerbek
  • 4,806
  • 16
  • 87
  • 193
2
votes
2 answers

url for accounts/profile in Django

I'm using Django 1.11 and new to it. I'm using default login and logout functions. When I login, it redirects to accounts/profile and then generates error as Using the URLconf defined in myapp.urls, Django tried these URL patterns, in this…
Anuj TBE
  • 9,198
  • 27
  • 136
  • 285
2
votes
1 answer

Is it possible to use django-modeltranslation outside of admin?

I use django-modeltranslation app in my Django 1.11 project. I successfully install app and make settings, also registered models for translation as it was recommended in docs. Question: Is it possible to use this app outside of admin? If it…
2
votes
1 answer

init MultipleChoiceField with queryset

In django 1.9 i can init MultipleChoiceField with forms.py class MyForm(forms.Form): city = forms.MultipleChoiceField() def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['city'].choices =…
warcholprzemo
  • 106
  • 1
  • 7
2
votes
1 answer

Django prefetch_related outputs None

I'm new to Django. I am making a simple store. Currently I am working on the Order section. Every Order has Order Items inside it. Every order item has some values and a product id. What I am trying to display on the index.html, is the orders and…
Sharpless512
  • 3,062
  • 5
  • 35
  • 60
2
votes
1 answer

Django 1.11 (Python 3.+) doesn't work styles, when I make DEBUG=False

When I try it gives 404 error view, my styles doesn't work. I tried to create custom 404 view but it also doesn't work. Here is my code. settings.py DEBUG = False TEMPLATE_DEBUG = DEBUG ALLOWED_HOSTS = ['*'] TEMPLATES = [ { …
David Grigoryev
  • 125
  • 1
  • 11
2
votes
1 answer

Create a User and ExtendedUser object in one form using an Inline formset?

I have a model Sachbearbeiter which extends my User model. from django.contrib.auth.models import User class Sachbearbeiter(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) verein = models.ForeignKey(Verein) Now I…
Daniel
  • 3,092
  • 3
  • 32
  • 49
2
votes
1 answer

makemigrations doesn't see changes after adding unique_together constraint

Using django version 1.11.2 final. I have the model below, for small invoices. I made several migrations along the way, and eventually added the unique_together = ('facture', 'article') constraint into the 'Line' model. However, when running…
Lapin-Blanc
  • 1,945
  • 1
  • 17
  • 26