django-views

Try to Return dataset as a table with request of postman

Try to Return dataset as a table with request of postman Question: I wanna Request with postman and get a table of all books as return but I can’t find a way to do this. Thanks a lot This is my model of books: class Book(models.Model): name = models.CharField(max_length=100) username = models.ForeignKey(User, on_delete=models.CASCADE) publication_date = …

Total answers: 1

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

Django ModelForm as a layer of data validation

Django ModelForm as a layer of data validation Question: I have an authorization form, and I get an error – "already have a user with this email". I want to use the forms as a layer of validating the data. I now, that i can pass instance of CustomUser in my form, but i can`t …

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

Django form is not displaying all fields

Django form is not displaying all fields Question: I have a problem, i need to create form like scheme, i have my models and created forms.py.When i add my forms into the HTML, i have only 2 of all fields in my forms.What it can be? This is my models.py class Post(models.Model): full_name = models.CharField(max_length=60, …

Total answers: 3