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

Django static file in if statement

I am trying to display either or ( or

) if an image is retrieved from a static URL. So if this fails to load an image. {%for team in object_list|slice:":1"%}
Venor
  • 347
  • 2
  • 5
  • 17

0
votes
1 answer

How to save unix epoch datetimeformat like this (2019-11-12T10:26:39.613Z) into models.DateTimeField accurately

How can I save in this unix epoch datetimeformat like this 2019-11-12T10:26:39.613Z into models.DateTimeField accurately I tried with this but as you can see, assigning with datetime.datetime.strptime seems correct, but after I save it, the…
Axil
  • 3,606
  • 10
  • 62
  • 136
0
votes
1 answer

How to get the id of a current object in Django serializers?

I have a model, 'Project'. The idea is that, a user will log in and create a project. After creating, the user will work on this project at any time. Certain details will be saved to other models where I have written custom functions for it in…
0
votes
0 answers

Adding an autoincrementing model to django 1.11 with UUID as primary key

I have a legacy Django Application (1.11) which uses UUID as primary key, hence doesn't have an ID field. My DB is postgres class model_name(models.Model): .... #model data ... companyId = models.UUIDField(primary_key=True, default=uuid.uuid4,…
kmcodes
  • 807
  • 1
  • 8
  • 20
0
votes
2 answers

retrieving Django object returns AttributeError: module 'types' has no attribute 'StringTypes'

I'm attempting to migrate my apps from py2 to py3, and I'm running into this error when running migration scripts. After some digging, I get the same error when doing MyModel.objects.get(id=) Now, I know StrginType is obsolete in python3…
JChao
  • 2,178
  • 5
  • 35
  • 65
0
votes
1 answer

How to solve the CORS error in Socket.IO Django framework using Python 2.7

We are using AngularJS and Django frontend and backend respectively. We are facing CORS error as we added corsheaders in installed_app and also added middlewares still we are facing the same problem We are using AngularJS v1.6.3, Django 1.10.11 and…
0
votes
1 answer

Django using F expression and converting result to total_seconds during an Update

I am trying to update a set of instances based on the current values per instance. responses.update( last_paused=now(), duration=F('seconds_remaining')-(now() - F('last_accessed')).total_seconds() ) But I get this error: Traceback (most…
nael
  • 1,441
  • 19
  • 36
0
votes
1 answer

Get list of time zones with time difference from GMT

I have a Django application and I have a list of timezones hardcoded. I know pytz can be used to get a list of all timezones. But it does not show their time difference with respect to GMT. Please suggest how to get a list like…
Sachin Singh
  • 7,107
  • 6
  • 40
  • 80
0
votes
1 answer

Handle invalid data when using Django UpdateView subclass for object duplication

I'm doing the following, which works nicely when the user proceeds down the golden path: class MyUpdate(UpdateView) # ... class MyDuplicate(MyUpdate): def get_context_data(self, **kwargs): context = super(MyDuplicate,…
pdoherty926
  • 9,895
  • 4
  • 37
  • 68
0
votes
2 answers

My objects are not getting filtered despite setting the get_queryset function in views.py

I want to make an api to get the detail view of a blog from a list of published blog posts. To solve that, I am using get_queryset() filters to solve this, but it is simply giving back all the list, i.e. no filter worked. I have used the code as…
0
votes
4 answers

Django - Post data not in form.cleaned_data leading to key error

I have a dynamically created form build with Django. When this form is submitted i can see all the data in request.post, that being said when i access form.cleaned_data one of the inputs is not there. This is causing a KeyError when i try to access…
blobbymatt
  • 317
  • 1
  • 2
  • 17
0
votes
0 answers

Django QuerySet: Cannot resolve expression type, unknown output_field

I have a tree structure in postgres and I want to get the number of nested nodes for each visible node counting all children except the hidden child and its descendants. You can look at the SQL query to get an idea. I am trying to implement…
0
votes
0 answers

How to use Masquerade in Django 1.11+

Masquerade option is no longer supported in Django 1.11 , so what is the alternative to it ? Any known fix available for it ?
Storm
  • 355
  • 5
  • 14
0
votes
0 answers

Django admin inline is not working as describe in docs

I have broker and broker subscription to programs as defined blow. Given the django docs, it should be no brainy work to setup program subscription as inline in broker admin view, but its not working as expected. Do I need to add form for inline…
sakhunzai
  • 13,900
  • 23
  • 98
  • 159
0
votes
1 answer

Django console message: GET /%7B HTTP/1.1

Between once a second and 10 times a second I get the following message displayed on the console: "GET /%7B HTTP/1.1" 404 26453 After running python manage.py runserver I believe it has some relation to my carousel image strip because it stops…
Jordan Savage
  • 196
  • 2
  • 16