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

CSRF verification failed when in chrome incognito

I recently upgraded my application from Django 1.11 to Django 2.0. I am facing an issue when trying to logging in while in the incognito mode of Google Chrome, only the first time I get: Forbidden (403) CSRF verification failed. Request aborted..…
thyago stall
  • 1,654
  • 3
  • 16
  • 30
0
votes
1 answer

DJANGO - Add field to default auth.User model - simplest way

Looking for a simplest way to add one field to Django's User model. I have two types of users with different fields - Company and Customer so I decided to create two types of UserProfiles. CompanyProfile and CustomerProfile. Every user has either…
Milano
  • 18,048
  • 37
  • 153
  • 353
0
votes
1 answer

Django 2.0 URL regular expressions

I'm trying set an offset but I want to limit it to a maximum of 99 hours by only allowing either one- or two-digit numbers but I'm not sure of the syntax to use with Django 2.0. I've tried to look for updated documentation but I can't find it,…
Ceginner
  • 29
  • 1
  • 5
0
votes
1 answer

Calculate price in models with django v2.1

I need your help about this app I'm making, in those models, I want the price of the topping and the type be calculated automatic in the model Pizza, so when someone record new data, he can choice the type and the topping and the price is calculated…
soultaker
  • 15
  • 1
  • 6
0
votes
2 answers

First attempt at Django (2.0) models resulting in AttributeError when making migrations

As a complete beginner, I really hope I'm missing something obvious here, and that someone with experience can easily point out my mistake. I'm in the first steps of creating some Django models, and can't figure out how to resolve an error I get…
Derrick
  • 1
  • 2
0
votes
0 answers

Is there anyway to filter all ORM queries in Django?

So I have a rather unorthodox idea of using a middleware to filter queries dynamically, as to keep my authentication further away from the views themselves. I've seen a few library's that could log transactions, but there's no way to alter them…
SeedyROM
  • 2,203
  • 1
  • 18
  • 22
0
votes
0 answers

django: code changes not getting reflected

I am using Django 2.0. I wanted to use firebase cloud messaging, so i have installed fcm_django. I have to replace is_authenticated() with is_authenticated (without the brackets) in the rest_framework.py file. SO i have edited the file…
Santhosh
  • 9,965
  • 20
  • 103
  • 243
0
votes
1 answer

can not login with Extended AbstractBaseUser model

I'm using Django 2.0 I have extended the AbstractBaseUser to make some modification to the email and use email as username class UserManager(BaseUserManager): def create_user(self, email, password=None, is_staff=False, is_superuser=False): …
Anuj TBE
  • 9,198
  • 27
  • 136
  • 285
0
votes
1 answer

AttributeError: 'module' object has no attribute 'lru_cache' while installing Django 2

I'm using ubuntu and I got python 2.7 and python 3.4.3 installed on my OS. I'm trying to upgrade to Django 2. ButI get this error while trying to install it using pip install -U Django or pip install Django --upgrade: Traceback (most recent call…
Ghasem
  • 14,455
  • 21
  • 138
  • 171
0
votes
1 answer

Django use dynamic choices in model by foreignkey

I have a model; for concern to this question it matters two field one is foreignkey to other model Plan and other is choicefield as shown below: class MyModel(models.Model): CHOICES = ( (1, 'A1'), (2, 'A2'), (3, 'B1'), …
Gahan
  • 4,075
  • 4
  • 24
  • 44
0
votes
2 answers

how to switch to path instead of url in urlpatterns [django]

django noobie. ive been going through tutorials but in urlpatterns they use url instead of path which is now introduced in django 2.0 i want to make /appname/anything-gibberish take the user back to the view im giving in /appname/ urlpatterns = [ …
Raven11
  • 31
  • 1
  • 7
0
votes
2 answers

error deploying django 2.0 to heroku

I have created my first Django 2.0 project and trying to deploy it into Heroku. I have have setup all and all push and pull goes well. But when I access my application endpoint with https://jotitdown.herokuapp.com It is not loading and heroku logs…
Anuj TBE
  • 9,198
  • 27
  • 136
  • 285
0
votes
0 answers

using request.user in templatetags in Django

I am using Django 2.0 I have three tables notes, starred and shared notes model def Notes(models.Model): title = models.CharField() def Starred(models.Model): note = models.ForeignKey(Note, on_delete=models.CASCADE) user =…
Anuj TBE
  • 9,198
  • 27
  • 136
  • 285
0
votes
1 answer

Django admin loads view template when url pattern is same as model name

I'm writing my first Django project in Django 2.0. I noticed another weird behavior with Django urlpatterns. I have an app starrednotes and model within it as Starred(models.Model) same is the case with Shared(models.Model) within sharednotes app I…
Anuj TBE
  • 9,198
  • 27
  • 136
  • 285
0
votes
1 answer

How to create different model database for different user in Django

I am trying to create a todo website. In that all the users will have their own list of Todos. But it is showing the same list to all the users and also, other users can edit,delete and add to the todo-list which is again visible to all the…
Vaibhav Gupta
  • 650
  • 7
  • 15