django-templates

Django Not Found: /media/ , GET /media/ HTTP/1.1" 404 2679

Django Not Found: /media/ , GET /media/ HTTP/1.1" 404 2679 Question: I am currently building a project which i have to use media. Since i have used media before i copy pasted everyting from my other project and altough the original is working my current project is not. I can upload and select fotos thru …

Total answers: 2

How to hash stored passwords in mysql using pbkdf2_sha256 using Django

How to hash stored passwords in mysql using pbkdf2_sha256 using Django Question: I have list of user passwords stored as plain text. I think I need a script to run over the stored passwords and hash them. I’m new to Django and not sure where to start or how. I created login and creating accounts …

Total answers: 1

rtsp stream with django

rtsp stream with django Question: I’m trying to put a url based on my views.py but it returns the error: Reverse for ‘transmition’ not found. ‘transmition’ is not a valid view function or pattern name. project urls.py: from django.contrib import admin from django.urls import path, include from django.conf.urls.static import static from django.conf import settings from …

Total answers: 1

For loop with range in django template

For loop with range in django template Question: How can I make a for loop with range function in django template? I want to search in three lists by using this structure. I tried this and it didn’t work: {% for i in range(number) %} {{ my_list.i }} {% endfor %} Asked By: mhn || …

Total answers: 1

Issue with passing arguments to button onClick js function with Django template

Issue with passing arguments to button onClick js function with Django template Question: I am using django template as standalone. When using it, the Django template rendering is escaping single-quotes (adding to ‘) for the arguments of onClick function call. <button id="order" onclick="myFunction(‘{{ val }}’)"> {{ val }} </button> when rendered in python with with …

Total answers: 2

Django 'QuerySet' object has no attribute 'startswith'

Django 'QuerySet' object has no attribute 'startswith' Question: I’m new to Django and I created function to allow admin to create users accounts. I used a password generator + make_password() function to hash the password. Now it’s sending the plain password to users email and storing it in the database hashed, I used check_password() to …

Total answers: 2

using if else condition with for loop in Django

using if else condition with for loop in Django Question: I fairly new to Django, I have a list of usecase model shown in a a table, and a usecase progress model that includes a foreign key of the usecase. Initially a new usecase doesn’t have a progress yet, so in my template I’m trying …

Total answers: 1

How to show and keep the last record in Django

How to show and keep the last record in Django Question: I’m new to Django I hope I’m making sense. I have two models: Usecase and Usecase_progress. I’m creating a page where I can see a list of all the use cases with their information + the usecase progress for each use case gets recorded. …

Total answers: 1

Chain-Model Getting all objects for template

Chain-Model Getting all objects for template Question: models.py class Sirket(models.Model): isim = models.CharField(max_length=20) def __str__(self): return f"{self.isim}" class Proje(models.Model): ad = models.CharField(max_length=20) total = models.DecimalField(max_digits=20,decimal_places=0) kalan = models.DecimalField(max_digits=20,decimal_places=0) tarih = models.DateField() firma = models.ForeignKey(Sirket, on_delete=models.CASCADE) def __str__(self): return f"{self.ad}" class Santiye(models.Model): isim = models.CharField(max_length=20) kasa = models.DecimalField(max_digits=20, decimal_places=0, default=0) araclar = models.ManyToManyField(Arac) baglanti = models.ForeignKey(Proje, …

Total answers: 2