Questions tagged [django-2.2]

Django 2.2 is a version of the Django framework, released April 2019. It is a Long Term Support (LTS) release, and will be supported until at least April 2022. Please only use this tag if your question relates specifically to this version.

Django 2.2 works with Python 3.5, 3.6, 3.7, 3.8, and 3.9.

release notes

261 questions
0
votes
1 answer

change function based view in Class Based View for Form "request" handling

I am following a tutorial where a Cart is made for Products handling. the is a function to add the items in the cart as @require_POST def cart_add(request, product_id): cart = Cart(request) product = get_object_or_404(Product,…
Deshwal
  • 3,436
  • 4
  • 35
  • 94
0
votes
1 answer

Cannot make migrations in Django2 - there is a ModuleNotFoundError

I am brand new to Python and django and I am trying to build my own web api. My folder structure is as follows:…
babycoder
  • 184
  • 1
  • 2
  • 17
0
votes
1 answer

error in AUTH_USER_MODEL after upgrading Django

i am working on django 1.8 and python 2.7 then i upgraded my django to 2.2 and python to 3.6 but when i run python manage.py runserver i got error in terminal that show me: django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to…
Odai Nasser
  • 112
  • 10
0
votes
1 answer

Unusual behavior of form during the creation of a blog post

I'm developing the backend of my personal blog and, using this tutorial for the date and time, I've created a form for the creation of a blog post. Even if I select one or more tags, they aren't added to the post. The post after the pubblication…
0
votes
1 answer

NoReverseMatch error for update and delete view

I've a trouble with an update view and a delete view. Below the code: views.py from django.shortcuts import get_object_or_404, redirect, render from django.utils.text import slugify from .forms import BlogTagForm from .models import BlogTag def…
0
votes
0 answers

insert or update on table "app_job" violates foreign key constraint "app_job_user_id" DETAIL:Key (user_id)=(1) is not present in table "accounts_user"

I have used function based View to get data from post Request. I need to get many data that also include a primary key field too. I need to push data into two models. While doing so, I encountered error. #accounts models.py from django.db import…
Aayush Bhattarai
  • 510
  • 1
  • 7
  • 16
0
votes
3 answers

How can I pass current logged in user while form submission in django?

I am trying to create a form that allows current logged in user to submit data. The form comprises of the field - amount, rate(interest), timestamp(automatically picked up), and currently logged in user. Data is not passing into the database and…
Manish
  • 501
  • 4
  • 11
0
votes
2 answers

Using Django 2.2 Models with multiple foriegn keys ,how can one access and filter data?

I have this model of products class Product(models.Model): name = models.CharField(max_length=50) productId = models.AutoField(max_length=50,primary_key=True) productType = models.CharField(max_length=50) productPrice =…
Dushyant Deshwal
  • 388
  • 4
  • 17
0
votes
0 answers

How to enter ForeginKey values in a model with CreateView

I am creating a wiki and need to put in values in the model called revision. This table has a foreigkey to wikipage. My problem is that I am unable to insert values in the revision model. I have tried using def form_valid(self, form) like you would…
0
votes
1 answer

FileSystemStorage doesn't work and when 2 images uploaded, SuspiciousFileOperation error is returned

I'm having a terrible issue. I want to upload 2 images and get a result after running them through a lot of code. However, when I choose the path (on the server) as to where to upload these files, I always get a "SuspiciousFileOperation" error. api…
Kyoko
  • 65
  • 1
  • 2
  • 6
0
votes
1 answer

How to protect SELECT * FROM var1 WHERE var2 statements from SQLInjection

I am making a website in django where I want the user to put in a table id and group id and then return the table and group that the put in. However, I have only found statements that are prone to SQL injection. Does anybody know how to fix…
Agent Lu
  • 104
  • 13
0
votes
1 answer

How to update multiple objects by one html request?

I have a problem and can't find a decision. I need to update a value for several objects by one form. If I did it one by one, without submit button it works fine. But I want to do it by click to one button. My HTML form:
0
votes
1 answer

Pviz Html file shows correct graphic when locally opened but on server no graphic appears

I am creating a website and want to show a image based on the protein sequence that a user inputs. I am using the genentech Pviz GitHub to help me create the graphic and have copied an example from their website. It work completely fine and shows…
Agent Lu
  • 104
  • 13
0
votes
1 answer

Button for updating a blog post

I've a trouble to create correctly a button based on Bootstrap 4.3 with which activates the update of a post. I've created this view: def updatePost(request, slug_post=None): update_post = get_object_or_404(BlogPost, slug_post=slug_post) …
MaxDragonheart
  • 1,117
  • 13
  • 34
0
votes
1 answer

Image url from an ImageField used as ForeignKey

I'm trying to see an image inside a template using this tag {{ post_details.header_image.url }}. When I do this the image doesn't appear. models.py class ImageUpload(models.Model): name = models.CharField( max_length=50, ) …
MaxDragonheart
  • 1,117
  • 13
  • 34