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
1
vote
1 answer

ImageField / FileField Django form Currently unable to trim the path to filename

I have a ImageField that stores in AWS S3 (similar to FileField). In the form, it has this "Currently" label that shows the image file path. I would like to trim and just show the filename. referring to the latest answer in Django : customizing…
Axil
  • 3,606
  • 10
  • 62
  • 136
1
vote
1 answer

Django Signal Registration Throws Incorrect AppnameConfig.name Error

I am developing a Django app 1.11, for example i want email should send after user registration, so I decide to use signals for send email, now instead of putting signal handlers and register code in modal file , I created the signals.py in my app…
Hari
  • 1,545
  • 1
  • 22
  • 45
1
vote
1 answer

How in CBV correctly redirect user if he dont have permission?

I want to redirect user to url (reverse_lazy('dashboard')) if Class Based View is not available to user (he dont have permission). I use next code but it dont redirect user. Whats wrong? views.py: from django.contrib.auth.mixins import…
Nurzhan Nogerbek
  • 4,806
  • 16
  • 87
  • 193
1
vote
1 answer

Django UpdateView and ChoiceField issue. Django 1.11 python 3.6

I am facing a strange problem while implementing ChoiceField and UpdateView in django. I have made a small clip showing the problem that I am facing. Please watch it with subtitles/cc enabled. It will give an idea about the problem I am facing.…
1
vote
3 answers

How correctly add permissions to User model of Django?

I am tring to add custom permissions to User model (django.contrib.auth.models). To __init__.py file of my users app I add: from django.db.models.signals import pre_migrate from django.contrib.contenttypes.models import ContentType from…
Nurzhan Nogerbek
  • 4,806
  • 16
  • 87
  • 193
1
vote
0 answers

POST method with 2 form in CBV | Django?

I have 2 forms in one template: UserEditForm and UserRoleForm. As you can see UserRoleForm is a custom Form. How to save form data by post method in Class Based View? get method works fine but I cant save data by post method. Next code raise error…
1
vote
1 answer

Class based view - get function is not being called

Trying to use Django-filter class based view FilterView but I have problems with rendering filter in the template. It seems the filter is not in contex. DOCS:…
Milano
  • 18,048
  • 37
  • 153
  • 353
1
vote
0 answers

Django: FieldError: Invalid field name(s) for model

When i'm trying to use update or create query it's gives error FieldError: Invalid field name(s) for model Here it is my models.py class Base(models.Model): created = models.DateTimeField(auto_now_add=True) modified =…
NIKHIL RANE
  • 4,012
  • 2
  • 22
  • 45
1
vote
2 answers

installing Pillow for Python (3.6.3) on ubuntu (16.04 LTS)

I installed Django (1.11) on a Python (3.6.3) virtual environment running on a Ubuntu 16.04 LTS server. My Django app contains images and Django dev server won’t start without Pillow installed. I’m having a hard time trying to install Pillow. From…
1
vote
2 answers

Performant calculation of datetime diffs in days

I have a Django model that contains a unique record with a date . I'm currently counting records into ranges of days, e.g. X Number have already passed todays date, X will happen within the next 10 days, X will happen within the next 30 days. The…
Draineh
  • 599
  • 3
  • 11
  • 28
1
vote
1 answer

Remain logged in ldap between views using Django

I'm using the ldap3 module and trying to create a simple Web App to search for users in an ldap server. The user (help desk people normally, doing the searching) must log in and input the user searched for. The code so far creates/binds to the ldap…
pymat
  • 1,090
  • 1
  • 23
  • 45
1
vote
2 answers

django form data not saved in database

I have a form to make POST data to database. I'm using Django 1.11 views.py class BusinessCreate(CreateView): model = Business fields = '__all__' @method_decorator(login_required) def dispatch(self, *args, **kwargs): …
Anuj TBE
  • 9,198
  • 27
  • 136
  • 285
1
vote
0 answers

Routers urls with django rest framework 3.6 and django 1.11

I have a django 1.7 with djangorestframework 3.3.2 site, and I'm migrating to django 1.11 with DRF 3.6. All things are working fine except routers with urls. My Router: router = routers.DefaultRouter() router.register(r'options', MicrositeViewSet)…
dfrojas
  • 673
  • 1
  • 13
  • 32
1
vote
2 answers

Foreign key defaults to Auth User in Django

I'm using Django 1.11 I have a business model. class Business(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) name = models.CharField(max_length=200) business_type = models.ForeignKey(BusinessType,…
Anuj TBE
  • 9,198
  • 27
  • 136
  • 285
1
vote
1 answer

save slug for product and company as soon as they are saved

I have a product and company model where slug is included for better detail view in the url. I have used pre_save signal to save the slug as soon as the product and company are saved to the database. The code I have written is not saving the slug so…
milan
  • 2,409
  • 2
  • 34
  • 71