Questions tagged [django-2.0]

Django 2.0 is a version of the Django framework, released December 2017. Please only use this tag if your question relates specifically to this version.

Django 2.0 requires Python 3.4, 3.5, or 3.6. It is the first version of Django to support only Python 3.

Here are some of the salient features of Django 2.0:

Django 2.0 was released in December 2017 and was supported until April 2019.

423 questions
10
votes
1 answer

What is the difference between path() and re_path()?

In Django2.0 were introduced path() and re_path(). But the difference between boths is unclear to me : is it about the ability to use or not regexps with it? Would that mean that I couldn't use both and (?P\d+) syntaxes in the same…
vmonteco
  • 14,136
  • 15
  • 55
  • 86
9
votes
2 answers

Django REST Framework URLs with Django 2.0

I'm trying to set up Django REST Framework with Django 2.0 project which means url(r'^something/' ... has been replaced with path(something/ .... I'm trying to work out how to set up my rest_framework patterns. This is what I have: router =…
HenryM
  • 5,557
  • 7
  • 49
  • 105
8
votes
2 answers

include() got an unexpected keyword argument 'app_name'

i am making a blog application for my website with django-2.0 when i run server i see the following error File "C:\Users\User\Desktop\djite\djite\djite\urls.py", line 7, in url(r'^blog/', include('blog.urls', namespace='blog',…
7
votes
2 answers

Django: Search many to many field while creating object

I've got a use case where I have multiple Ingredient that can be linked to a Recipe through the Django admin. Now I have around a hundred ingredients which makes it very difficult to select the ingredients in the following UI. Is there a way to add…
danialzahid94
  • 4,103
  • 2
  • 19
  • 31
7
votes
4 answers

Why should I set max_length when using Choices in a Django model?

In the official Django 2 tutorial I found this: from django.db import models class Student(models.Model): FRESHMAN = 'FR' SOPHOMORE = 'SO' JUNIOR = 'JR' SENIOR = 'SR' YEAR_IN_SCHOOL_CHOICES = ( (FRESHMAN, 'Freshman'), …
ladybug
  • 323
  • 1
  • 4
  • 9
7
votes
2 answers

How to upload multiple images from a single "Choose Files" selector in django admin

I'm doing this little project simulating a clothing ordering system to brush up my django skills. I have to add several pictures of a certain item(not a fixed number). So, using a fixed number of image fields in Item model is not ideal. So, I…
user9229406
7
votes
3 answers

Error when using include('admin.site.urls'): Passing a 3-tuple to include() is not supported

I'm fairly new to Python and I am using a video tutorial on Lynda to help me build the frameworks for a Social WebApp. I'm trying to run the server from the cmd using python manage.py runserver from the cmd, however, I keep running into this error…
6
votes
2 answers

Iterable object and Django StreamingHttpResponse

I want to connect to internal http services with django and I need to buffer the output the http response of those services because some contents are very large. I am using python 3.6, django 2.0, http.client and the following code: class…
Felipe Buccioni
  • 19,109
  • 2
  • 28
  • 28
6
votes
1 answer

How to integrate multi-languages support by creating language files in Django 2.0?

I want to create a Django 2.0 powered website(including auto generated Admin site) that should support multiple languages. For now I only want to keep 2 languages English and Arabic. I read number of tutorials articles on web to use django-admin's…
hygull
  • 8,464
  • 2
  • 43
  • 52
5
votes
1 answer

how to implement Django-Private-Chat in Django 2

I'm working on a project in which I need to implement private chat for user, so one user can communicate with another user privately, for that purpose I'm using django-private-chat but I'm confused in how to implement this in my application? Here's…
Abdul Rehman
  • 5,326
  • 9
  • 77
  • 150
5
votes
1 answer

Adding values to Django QuerySet

Is there any way to append a non-Django supplied value to a query? For instance, to find out if a store closed, I may run a function called get_closed_stores() which returns a list of closed stores. Stores Closed [00090, 00240, 00306, 00438, 03005,…
CodeSpent
  • 1,684
  • 4
  • 23
  • 46
5
votes
2 answers

Are PermissionsMixin and PermissionRequiredMixin the same?

I want to know if PermissionsMixin has the same function as PermissionRequiredMixin. from django.contrib.auth.models import PermissionMixin from django.contrib.auth.mixins import PermissionRequiredMixin
Andres Manuel Diaz
  • 129
  • 1
  • 2
  • 8
5
votes
2 answers

ModuleNotFoundError: No module named 'pip.download' when trying to install Python package for Django

When trying to install Numpy and other packages using pip. I get a message saying ModuleNotFoundError: No module named 'pip.download'. Anyone know any possible solutions for this? I'm currently running on Python3. I've had a look at similar problems…
Todd Drinkwater
  • 379
  • 6
  • 17
5
votes
2 answers

URL patterns in Django 2

I just have started my first project by using Django 2.0 in which I need to define a URL in a way as: http://localhost:8000/navigator?search_term=arrow But I couldn't know how to define a string parameter for a URL in Django 2.0 Here's what I have…
Abdul Rehman
  • 5,326
  • 9
  • 77
  • 150
5
votes
2 answers

Custom LoginView in Django 2

I am trying to customise the authentication and view in Django 2 but the problem is that if the user is already authenticated the login form is still shown and it is not redirected to the appropriate URL. To get over this I have done the…
Akshay
  • 2,622
  • 1
  • 38
  • 71
1
2
3
28 29