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
2 answers

In django 2.0, writing a script to delete models

I have tried every answer on the (Django script to access model objects without using manage.py shell) stack question, and I always get error "no module name 'project_name'". My project name is called snapbackend. I have an __init__.py setup. I know…
Rahmi Pruitt
  • 569
  • 1
  • 8
  • 28
0
votes
1 answer

Django: Uploading files with AJAX: Form says that the file input field is empty (or CSRF token missing or incorrect)

I'm trying to add a very simple file upload modal form in my Django app. But, when I click the submit button, the form shows me an error message: "this field is required". Everything renders correctly: My main page loads correctly When I click in…
Barranka
  • 20,547
  • 13
  • 65
  • 83
0
votes
1 answer

django 2 - User and userprofile models, how to obtain all fields in a single query?

Update and solution below. I've been looking for a solution but I'm not finding anything that sticks out. I've created a Profile model which is linked to the standard User model via one-to-one field which is working in admin. I want to pull all…
David
  • 85
  • 8
0
votes
1 answer

django - import file from project into downloaded app within site-packages

I have a signal within an app on my project and i need to import it in an app I've downloaded which is stored with in site-packages. Is this possible? myproject / src / signals.py myprojectenv / lib / python3.6 / …
Mint
  • 1,013
  • 1
  • 12
  • 29
0
votes
1 answer

How to create an object inside the CreateView in Django?

I want to create and save an object in my View using CreateView. > example in django documentation, uses a form to create new object while I have the fields value (I know the user and the book he selected) and want to create it inside the view,…
0
votes
1 answer

Django 2.0 Migration Error : "django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet."

I'm having trouble with django. I'm starting a new project with only a single app, and when I'm adding one model, I can't migrate it. Error message when migrate (or makemigrations) : (MapEnv)…
rSim
  • 344
  • 4
  • 17
0
votes
1 answer

Django - Multi filtering queryset return empty queryset

I have a problem with queryset in Django 2.0, after some research, I don't find any problem looks like mine. I think it's because of my very old legacy database create by someone I didn't know. So, I have a sqlite database who looks like this: Has…
Florian
  • 61
  • 1
  • 11
0
votes
1 answer

How to save post into Django (2.0) like I bookmarked it

How to save a post into Django (2.0) like I bookmarked that post for later usage. I need to implement it into one of my project.
Shohan
  • 11
  • 1
  • 6
0
votes
1 answer

can't import models from django custom seed command

I have a django 2.0.6 project running on python 3.6. I'd like to create a manage.py command that seeds the project database with initial data using faker and factory_boy. I have the subcommand working and printing to stdout. When I try to import the…
0
votes
1 answer

Django 2.0 - Rendering wrong template (with no error)

I'm trying to load a template visit_form.html which is a DetailView with a form within it. Each time I click on a link from main.html the wrong template gets loaded -> main_detail.html. I have cleared browser cache, invalidated caches. The goal is…
Nicolas
  • 374
  • 4
  • 18
0
votes
1 answer

Django 2.0, can't fix searchbar working in django 2.0

I have a problem with my search bar in Django. I create a simple view: class BookList(ListView): model = Book def book_list(request): books = Book.objects.all() search_term = '' if 'search' in request.GET: …
0
votes
0 answers

Django 2.0.6 manage.py getting runserver error

I'm new on python and also try to learn a Django version 2.0.6 , so when i try to write the code with the documentation of Django here: If faced a problem, specifically when I want to run the code, could help me to solve that issue please. 1- code…
0
votes
1 answer

How to *always* log exceptions and stacktraces in django with DEBUG = False

How do I set DEBUG = False, but ensure exceptions (wherever they may be thrown) are properly logged, including a stack trace. Here is my logging configuration: LOGGING = { 'version': 1, 'filters': { 'require_debug_false': {'()':…
daino3
  • 4,386
  • 37
  • 48
0
votes
1 answer

Django 2.0 Admin: Does delete confirm even if the ForeignKey on_delete field is set to CASCADE?

Switching from Django 1.9 (I know, it's out of compliance, hence the upgrade) to 2.0. I see on_delete is a required field for all ForeignKey fields. Previously when I would delete an object from Django Admin, it would run a check and confirm if I…
Furbeenator
  • 8,106
  • 4
  • 46
  • 54
0
votes
2 answers

Is it possible for Django to use the same link and a database for each client?

Is it possible for Django to use the same link and a database for each client? Hello, I'm new to Django and I have a question. I'm bringing a PHP system to Django where all clients use the same link to access the system, but each with its database…
ayrtonmoises
  • 66
  • 1
  • 3