Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django: django.db.utils.OperationalError: no such table: #deprecated_bug_assignee when to use "POST" method, but "GET" method is ok
GET Method can reponse data, happened error when to use "POST" method,the error is “ django.db.utils.OperationalError: no such table: #deprecated_bug_assignee ”, but "GET" method is ok, why? they are using the same table ! views.py from django.http import Http404 from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import status class DeprecatedBugAssigneeList(APIView): """ 列出所有的snippets或者创建一个新的snippet。 """ def get(self, request, format=None): dbsa = DeprecatedBugAssignee.objects.using('slave').all() serializer = DeprecatedBugAssigneeSerializer(dbsa, many=True) return Response(serializer.data) def post(self, request, format=None): serializer = DeprecatedBugAssigneeSerializer(data=request.data) if serializer.is_valid(): bug_serializer = serializer.save() bug_info = DeprecatedBugAssignee.objects.filter(bugid__exact=request.data['bugid']) bug_serializer.add(*bug_info) return Response(serializer.data, status=status.HTTP_201_CREATED) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) serializer.py from apps.cn_relnotes.models import DeprecatedBugAssignee, DeprecatedBugCode class DeprecatedBugAssigneeSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = DeprecatedBugAssignee fields = ('bugid', 'oassignee', 'nassignee', 'opdatime', 'operatornm', 'state', 'duration') models.py from django.db import models class DeprecatedBugAssignee(models.Model): bugid = models.IntegerField() oassignee = models.CharField(max_length=255) nassignee = models.CharField(max_length=255) opdatime = models.DateTimeField() operatornm = models.CharField(max_length=255) state = models.CharField(max_length=64, blank=True, null=True) duration = models.FloatField(blank=True, null=True) class Meta: managed = False db_table = '#deprecated_bug_assignee' unique_together = (('bugid', 'opdatime'),) urls.py from django.conf.urls import url from rest_framework.urlpatterns import format_suffix_patterns from apps.cn_relnotes import views urlpatterns = [ url(r'^v1/bug/$', views.DeprecatedBugAssigneeList.as_view()) ] urlpatterns = format_suffix_patterns(urlpatterns) -
Error after replacing appname with appname.apps.appnameConfig
As I write some code in appnameConfig.ready() for running them at the beginning of server start. I just change appname to appname.apps.appnameConfig in settings.INSTALLED_APPS and error occur as below: File "/home/user/venv/venv/lib/python3.8/site-packages/django/db/models/base.py", line 107, in __new__ app_config = apps.get_containing_app_config(module) File "/home/user/venv/venv/lib/python3.8/site-packages/django/apps/registry.py", line 252, in get_containing_app_config self.check_apps_ready() File "/home/user/venv/venv/lib/python3.8/site-packages/django/apps/registry.py", line 135, in check_apps_ready raise AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. What's wrong is it? -
Django: What could cause duplicate permissions to be created in the auth_permission table?
I'm currently working on a Django app that has been maintained for 4+ years at this point. I joined the team not too long ago. I was getting complaints about group permission issues, and after a lot of inspection, I found out that there were many duplicate permissions. id | name | content_type_id |codename ----+----------------+-----------------+-------- 1 can add x 1 add_x 2 can add y 2 add_y 3 can add y 1 add_y I see this kind of behavior in the table where the name/codename is a duplicate of some other valid entry, but then the content_type_id arbitrarily uses some other content_type_id that doesn't relate to it at all. It doesn't happen to every permission, but there are a quite a few in which it is happening. This is a pattern I have observed if the database that this app is connected to has been continually migrated/upgraded over years, then the auth_permission table seems to have this issue of duplicate permissions with random content_type_id. However, when I run the app on my local with the latest version and run the migrations on a fresh db, I get no such issues. I suspect it has to do something with migrations. Is … -
Better way to deal with private API which doesn't support CORS
I'm working on the Imperva API with axios. After digging the document of the API and doing some tests, the API seems like doesn't support CORS. Since that the Imperva API requires user to send requests with key, I think is not a good idea to use something like cors-anywhere. My current plan is to set up a CORS proxy on my backend server(Django). However, I'm not sure if this is a good way to solve the problem and also not sure if Django can do this trick. Please give me some advices on this. Thanks a lot! -
(Django, Python) json.decoder.JSONDecodeError: Expecting value: line 17 column 2 (char 636)
I have been trying to make an order/cart app for a sandwich shop. While I am testing I keep getting the error that has to do wich decoding the JSON data front-end engineers send me. Below is the POST request that the server receives. { "default_ingredients": [ { "id": 1, "name": "이탈리안 화이트 (top)", "image_url": "https://media.subway.com/digital/Account_Updates/Assets/App-Base/Web_Images/Subway/en-us/Options/o_BreadItalian_customizer_large.png", "price": "0.00", "ingredient_category_id": 1 }, { "id": 23, "name": "토마토", "image_url": "https://media.subway.com/digital/Account_Updates/Assets/App-Base/Web_Images/Subway/en-us/OptionsIds/10133_customizer_large.png", "price": "0.00", "ingredient_category_id": 3 }, ], "added_ingredients": [ { "id": 18, "name": "살라미", "image_url": "https://media.subway.com/digital/Account_Updates/Assets/App-Base/Web_Images/Subway/en-us/Options/o_TurkeyBasedHamSalamiBologna_customizer_large.png", "price": "0.00", "ingredient_category_id": 2 }, { "id": 19, "name": "페퍼로니", "image_url": "https://media.subway.com/digital/Account_Updates/Assets/App-Base/Web_Images/Subway/en-us/Options/o_Pepperoni_customizer_large.png", "price": "1800.00", "ingredient_category_id": 2 }, ], "product_name": "이탈리안 비엠티", } And below is my views.py for the order app import json import ast import jwt import bcrypt from django.views import View from django.http import JsonResponse from .models import ( Order, Cart, CartIngredient, DestinationLocation, OrderStatus ) from product.models import ( Product, Category, SubCategory, Nutrition, Ingredient, ProductIngredient ) from store.models import Store from account.models import Customer from codesandwich.settings import SECRET_KEY def login_required(func): def wrapper(self, request, *args, **kwargs): header_token = request.META.get('HTTP_AUTHORIZATION') decoded_token = jwt.decode(header_token, SECRET_KEY, algorithm='HS256')['email'] try: if Customer.objects.filter(email=decoded_token).exists(): return func(self, request, *args, **kwargs) else: return JsonResponse({"message": "customer does not exist"}) except jwt.DecodeError: return JsonResponse({"message": "WRONG_TOKEN!"}, status=403) except … -
Django: Static files are not found
I'm trying to add some static files to my project. I have tried adding a static folder to my app. I have two apps: Authentication (authn), Main (main). I have a lot of CSS/js content and I don't really know which is the best method to save the files, maybe all static files should be in one directory 'staticfiles' or each app should have 'static' folder. I have tried adding static folder to one of my apps, at this time - authn. And by trying to load the static files I firstly did python manage.py collectstatic, that put my all files into one folder, but I got two different folders now - admin, main. After tried putting all my static files into a static folder in authn app, but the static files were not loading after that. Here are my project structure and some photos and logs of the console, pycharm. -
Django Filtering too slow
I have a lot of data in my mongoDB and I'm trying to filter these data on my Django page in search form. User send parameters to views.py which conditions want to search and views.py search that data in DB and send result back in CONTEXT dictionary like this return redirect(f"/terema/kensaku/?q={url_data}&page={page_number}", self.CONTEXT) I'm searching data using this style all_searched_data = self.model.objects.filter(address__icontains=full_adress) where model is DB collection, full_address is a variable containing data from users. This work nice, when my users are very specific about searching, but when they try to search like typing only name of city to the full_address there is a too much matches in DB and user get Gateway Timeout. I want to say that django's filter + __icontains is too slow when I have a lot of matches. Is there a way to avoid this? Plus it brings my server cpu on 100% for like 20 minutes -
DJANGO BLOG POST PERMISSION
I need to create a django blog as follows, the administrator creates the content in django-admin, and directs the content to a specific user, this post can only be viewed by that user chosen by the admin -
Reverse for 'movie_detail' with arguments '('',)' not found. 1 pattern(s) tried: ['movie/(?P<slug>[-a-zA-Z0-9_]+)$']
I'm creating a Movie app in Django. Created slider in movie app trying getting last 3 value but it is not working, when I try to get last 3 value it shows error. I.m trying to retrieve values from the object in Django. I tried lots of things, none worked. I posted all my project files below. you can have a look. I would be glad if you guys help me. My code goes here : slider.py from .models import Movie def sider_movies(request): movie = Movie.objects.all().order_by('-id')[:3] return {'slider_movie':movie} urls.py from django.urls import path from .views import MovieList,MovieDetail,MovieCategory,MovieLanguage,MovieSearch,MovieYear app_name = 'movie' urlpatterns = [ path('',MovieList.as_view(), name = 'movie_list'), path('category/<str:category>',MovieCategory.as_view(), name = 'movie_category'), path('language/<str:language>',MovieLanguage.as_view(), name = 'movie_language'), path('search/',MovieSearch.as_view(), name = 'movie_search'), path('<slug:slug>',MovieDetail.as_view(), name = 'movie_detail'), path('year/<int:year>',MovieYear.as_view(), name = 'movie_year'), base.html {% load static %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Movies</title> <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"> <!-- Link Swiper's CSS --> <link rel="stylesheet" href="{% static 'css/swiper.min.css' %}"> <link rel="stylesheet" href="{% static 'css/styles.css' %}"> <script src="{% static 'js/jquery-3.1.1.min.js' %}"></script> <script src="{% static 'js/script.js' %}"></script> <!-- Demo styles --> <style> </style> </head> <body> <div class="wrapper"> <header class="header"> <figure class="logo"> <a href="/"><img src="{% static 'img/logo.png' %}" alt="Logo"></figure> </a> <nav class="menu"> <ul> <li><a href="/">Home</a></li> … -
How can I unuse some middlewares in some view?
For some reasons. I want to mark some middlewares as unused in some special view to improve its performance. Is there any functions or decorators in django I can use to do this? -
How to override Django AuthenticationForm inactive message
I am trying to display a custom error message when an account exists but is inactive. To do this I am overrriding the AuthenticationForm's error_messages. forms.py: class AuthForm(AuthenticationForm): error_messages = { 'invalid_login': ( "This custom message works" ), 'inactive': ( "This custom message does not." ), } urls.py: path('login/', auth_views.LoginView.as_view( template_name='employees/login.html', authentication_form=AuthForm), name='login'), As you can see the inactive message does not work. Thoughts on why? -
How to combine 2 queryset into one?
I have 3 models. Module, Task, and Lesson. Lesson is related to Module through an FK. Task is connected to Lesson through FK. I am trying to get all the lessons and tasks in a single queryset of a particular module. class Module(models.Model): name = models.CharField(max_length=255) class Lesson(models.Model): name = models.CharField(max_length=255) module = models.ForeignKey('module', on_delete=models.CASCADE) class Task(models.Model): name = models.CharField(max_length=255) lesson = models.ForeignKey('lesson', on_delete=models.CASCADE) I want to get all the related Lessons to a module and the tasks related to it in a single queryset. This is what I have tried module = Module.objects.get(id=57) lessons = Lesson.objects.filter(module=module) tasks = Task.objects.filter(lesson__id__in=[lesson.id for lesson in lessons]) -
heroku requirements.txt bug
Is there a bug that prevents this file from updating the correct python version for heroku to run ?. I have tried everything to get heroku to build python 3.7.7. I have deleted my heroku app and rebuilt it with same problems. (ERROR: Could not find a version that satisfies the requirement decouple==0.0.7) <-- this is because heroku is running a older version of python. I personally have nothing but problems getting heroku and django set up and working. I am setting up a simple web page. I'm surprised all the problems im encountering. -
How to fix Parsing error: Unexpected token?
I am trying to change my text color but I keep on getting Parsing error: Unexpected token as an error but don't know why can someone point out where my error is and how I would be able to fix that? Code is below import React from 'react'; import react, { Component } from 'react' import { Plateform, StyleSheet, view,text } from 'react-native'; **Here is where I am trying to change the text color everything seems to be in place but I keep on getting that unexpected token error?** function Header() { return ( <View style={style}> <Text style={[styles.setFontSize.setColorRed]} React Native Font example </Text> <header className="header"> <div className="col1"> </div> <div className="col2"> <div className="menu"> <h3>About</h3> <h3>Cars</h3> <h3>Contact</h3> <h3>Search</h3> </div> </div> </header> ); } export default Header extends Component; This is the error I get? ./src/components/header.js Line 10:78: Parsing error: Unexpected token return ( <View style={style}> <Text style={[styles.setFontSize.setColorRed]} React Native Font example </Text> ^ <header className="header"> <div className="col1"> </div -
Python 3: access resource folders in sub-modules
I have a Django app that is composed of a bunch of optional modules. In settings.py, I dynamically add the configured modules to INSTALLED_APPS and that's great. However, I would like to dispatch the translation files to their own sub-modules. For now, I have a simple: LOCALE_PATHS = ( os.path.join(BASE_DIR, 'locale'), ) On my dev machine, I could add [f"../{module}/locale" for module in loaded_modules] but implementers/production will use pip install <module> and won't be in the same location. I have seen that the way of doing that changed in Python 3.7 (OK) and would be to use a ResourceReader or get_resource_reader() method with a resource_path probably but I can't figure out how to implement that. I've seen a few examples with files where you directly open a file for reading but I'm looking to give the Django translations module a folder in which to search for translations. Anyone knows how I can do this ? (Leaving a Django tag because there might be a Django (translation) specific way of doing this) -
How to do filter(in=...) using a different list for every object I do filter on in Django?
I've written an implementation that explains what I mean. Is there a better way to do what I did? class Rstq(models.Model): pass class Baz(models.Model): rstq_set = models.ManyToManyField(Rstq, blank=True) class Foo(models.Model): # bar_set points to Bar because of many-to-many relationship def get_bars(self): bars = [] for bar in self.bar_set: if bar.rstq in bar.baz.rstq_set: bars.append(bar) return bars class Bar(models.Model): baz = models.ForeignKey(Baz, on_delete=models.CASCADE) rstq = models.OneToOneField(Rstq, on_delete=models.CASCADE) foo_set = models.ManyToManyField(Foo) -
displaye parent model form in chiled model in Django admin app
i want to create days using planing administration interface this what i tried but it seemes that it works for the opposite case models.py class Day(models.Model): SAMEDI = 1 DIMANCHE = 2 LUNDI = 3 MARDI = 4 MERCREDI = 5 JEUDI = 6 VENDREDI = 7 DAY_OF_WEEK = ((SAMEDI, 'Samedi'), (DIMANCHE, 'Dimanche'), (LUNDI, 'Lundi'), (MARDI, 'Mardi'), (MERCREDI, 'Mercredi'), (JEUDI, 'Jeudi'), (VENDREDI, 'Vendredi')) jds = models.PositiveSmallIntegerField( choices=DAY_OF_WEEK, blank=True, null=True) he1 = models.TimeField(auto_now=False, auto_now_add=False) hs1 = models.TimeField(auto_now=False, auto_now_add=False) he2 = models.TimeField(auto_now=False, auto_now_add=False) hs2 = models.TimeField(auto_now=False, auto_now_add=False) class Planing (models.Model): titre = models.CharField( max_length=150, unique=True, blank=False, null=False) description = models.CharField(max_length=400, blank=True, null=True) samedi = models.ForeignKey( 'Day', on_delete=models.SET_NULL, blank=True, null=True, related_name='+') diamanche = models.ForeignKey( 'Day', on_delete=models.SET_NULL, blank=True, null=True, related_name='+') lundi = models.ForeignKey( 'Day', on_delete=models.SET_NULL, blank=True, null=True, related_name='+') mardi = models.ForeignKey( 'Day', on_delete=models.SET_NULL, blank=True, null=True, related_name='+') mercredi = models.ForeignKey( 'Day', on_delete=models.SET_NULL, blank=True, null=True, related_name='+') jeudi = models.ForeignKey( 'Day', on_delete=models.SET_NULL, blank=True, null=True, related_name='+') vendredi = models.ForeignKey( 'Day', on_delete=models.SET_NULL, blank=True, null=True, related_name='+') admin.py class DayInline(admin.StackedInline): model = Day class PlaningAdmin(admin.ModelAdmin): list_display = ('titre', 'description',) inlines = [Dayinline] -
How do I Mock a method that makes multiple POST and GET request all requiring different response data?
I have looked at How to mock REST API and I have read the answers but I still can't seem to get my head around how I would go about dealing with a method that executes multiple GET and POST requests. Here is some of my code below. I have a class, UserAliasGroups(). Its __init__() method executes requests.post() to login into the external REST API. I have in my unit test this code to handling the mocking of the login and it works as expected. @mock.patch('aliases.user_alias_groups.requests.get') @mock.patch('aliases.user_alias_groups.requests.post') def test_user_alias_groups_class(self, mock_post, mock_get): init_response = { 'HID-SessionData': 'token==', 'errmsg': '', 'success': True } mock_response = Mock() mock_response.json.return_value = init_response mock_response.status_code = status.HTTP_201_CREATED mock_post.return_value = mock_response uag = UserAliasGroups(auth_user='TEST_USER.gen', auth_pass='FakePass', groups_api_url='https://example.com') self.assertEqual(uag.headers, {'HID-SessionData': 'token=='}) I also have defined several methods like obtain_request_id(), has_group_been_deleted(), does_group_already_exists() and others. I also define a method called create_user_alias_group() that calls obtain_request_id(), has_group_been_deleted(), does_group_already_exists() and others. I also have code in my unit test to mock a GET request to the REST API to test my has_group_been_deleted() method that looks like this: has_group_been_deleted_response = { 'error_code': 404, 'error_message': 'A group with this ID does not exist' } mock_response = Mock() mock_response.json.return_value = has_group_been_deleted_response mock_response.status_code = status.HTTP_404_NOT_FOUND mock_get.return_value = mock_response … -
django admin - subquery inside list_filter
Given are the following models class Report(models.Model): id = models.CharField(max_length=256, unique=True) name = models.CharField(max_length=256) confidential = models.BooleanField(default=False) class Owner(models.Model): report = models.ForeignKey(Report, on_delete=models.CASCADE) and the following admin.py from django class OwnerAdmin(admin.ModelAdmin): . . . list_filter = ('report__name',) As expected I get the option to filter based on the name of the report. Yet I would like to only get displayed to filter if the report is confidential, means that the confidential field of the given report is true. How can i achieve this? -
not giving value when i use inside for loop {{product.i.product_name}} but works fine when {{product.0.product_name}}
here is my model class Product(models.Model): product_id = models.AutoField product_name = models.CharField(max_length=200) description = models.CharField(max_length=600) pub_date = models.DateField() image = models.ImageField(upload_to="home/images") the views.py def home(request): products = Product.objects.all() n = len(products) params = {'product': products, 'range': range(n)} return render(request,'home/home.html',params) and the HTML for loop part is {% for i in range %} <div class="col-md-6 col-lg-4 text-center mt-4 "> <div class="card" style="width: 18rem;"> <img src="..." class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title">{{product.i.product_name}}</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a href="#" class="btn btn-primary">Go somewhere</a> </div> </div> </div> {% endfor %} the problem is when I am typing {{product.i.product_name}} it is not giving the product name but it is working when I am giving value instead of I like {{product.0.product_name}} I am not understanding what is the problem -
Django attribute reference error on models attribute: AttributeError: module 'classes.models' has no attribute 'Classes'
Not exactly sure why I am unable to reference a Class as a foreign key for my test results model. Is there something obvious that I am missing here? I was able to reference a user and test id without error, but can't seem to wrap my head around why class is not able to pull back Classes model. Any guidance will be helpful. I have posted my error message and models below. Error Message: Traceback (most recent call last): File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/opt/venv/lib/python3.6/site-packages/django/utils/autoreload.py", line 53, in wrapper fn(*args, **kwargs) File "/opt/venv/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run autoreload.raise_last_exception() File "/opt/venv/lib/python3.6/site-packages/django/utils/autoreload.py", line 76, in raise_last_exception raise _exception[1] File "/opt/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 357, in execute autoreload.check_errors(django.setup)() File "/opt/venv/lib/python3.6/site-packages/django/utils/autoreload.py", line 53, in wrapper fn(*args, **kwargs) File "/opt/venv/lib/python3.6/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/opt/venv/lib/python3.6/site-packages/django/apps/registry.py", line 114, in populate app_config.import_models() File "/opt/venv/lib/python3.6/site-packages/django/apps/config.py", line 211, in import_models self.models_module = import_module(models_module_name) File "/opt/venv/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in … -
Product order/purchase model in Django
I have a product model with name, description, currency, price, vendor and image fields, and I'm trying to implement ordering items, and I'm having a bit of trouble doing that. Basically, what I want is to be able to access an Orders model in the admin and add an order number, customer name (I have already implemented these two), and some products with each product having a quantity. # models.py from django.db import models class Vendor(models.Model): name = models.CharField(max_length=30) def __str__(self): return self.name class Product(models.Model): currencies = [ ('$', "US Dollars ($)"), ] name = models.CharField(max_length=40) description = models.TextField() currency = models.CharField(max_length=5, choices=currencies, default="$") price = models.DecimalField(max_digits=10, decimal_places=2) vendor = models.ForeignKey(Vendor, on_delete=models.CASCADE) image = models.ImageField(default="not_found.jpg") def __str__(self): return self.name class Customer(models.Model): name = models.CharField(max_length=30) date_of_birth = models.DateField() def __str__(self): return self.name class Order(models.Model): order_number = models.CharField(max_length=20) customer = models.ForeignKey(Customer, on_delete=models.CASCADE) My attempts/solutions: Adding ManyToManyField to Product (No Quantity) Creating ProductInstance class with fk to product and order (Quantity added but You have to visit 2 different pages in the admin, and you can't see the items in orders page of admin) Are there any other ways I can implement this or am I stuck with the second solution? It wouldn't … -
Django Admin - Overriding the "groups" selector widget
Django seems to use the FilteredSelectMultiple widget in its admin for groups and permissions. Since I have only two groups, I would like to replace the filtered widget with checkboxes. I tried using the CheckboxSelectMultiple widget, but I'm not sure what the problem is. The Django docs have this example: class MyModelAdmin(admin.ModelAdmin): formfield_overrides = { models.TextField: {'widget': RichTextEditorWidget}, } I'm using custom user and group models, and this is part of my code: from django.contrib.admin.widgets import FilteredSelectMultiple from django.forms import CheckboxSelectMultiple @admin.register(UserAccount) class MyUserAdmin(UserAdmin): formfield_overrides = {FilteredSelectMultiple: { 'widget': CheckboxSelectMultiple}, } fields = ("email", "password", "first_name", "last_name", "is_active", "is_staff", "is_superuser", "groups", ) It isn't working and I'm not getting any error messages either. Could someone please help me figure out what's wrong, or suggest a way to get checkboxes instead of the existing widget. -
Updating a Django Model from DetailView
I have a Django model that is receiving most of it's variable values from a form created by User 1 using CreateView. User 1 creates an object and selects most field values. Once the object is created it is posted to a wall, another user (User 2) can access the object and add information for the final unfilled field. My question is, how do I allow for this functionality in the DetailView html form? In the code below, "basketball.salary2" is the previously empty field User 2 will be inputting and posting in the DetailView. All other values are already filled in and displaying in the HTML. basketball_detail.html: {% extends "base.html" %} {% block title %}By: {{ basketball.creator }}{% endblock %} {% block content %} <h2>{{ basketball.creator }} has placed an opinion:</h2> <p>{{ basketball.creator }} says that {{ basketball.player }} deserves {{ basketball.salary1 }} <p> Do you agree with {{ basketball.creator }}? </p> <p>I believe {{ basketball.player }} deserves {{ basketball.salary2 }} <p> {% endblock content %} views.py: from django.shortcuts import render from django.views.generic import ListView, CreateView, DetailView from django.contrib.auth.mixins import LoginRequiredMixin from .models import Basketball class BasketballListView(LoginRequiredMixin, ListView): model = Basketball class BasketballDetailView(DetailView): model = Basketball class BasketballCreateView(LoginRequiredMixin, CreateView): model … -
What is the best language to make this site [closed]
I want to create site with connection to SQL, login through networks, live chat and a web-game. Here is an example: cs.fail . Please, what framework should I take up(except PHP), just one name and that’s all. It will change my life and this is really important to me;)