Why is my Aleart Message not appearing after the user login wasn't correct? Django, html, css

This is the Script in my signIn.html {% if messg %} <script> aleart("{{messg}}"); </script> {% endif %} This is my Django View def postsign(request): email = request.POST.get("email") passw = request.POST.get("pass") try: user = auth.sign_in_with_email_and_password(email,passw) except: message="Invalid credentials – try again" return render(request, "signIn.html", {"messg":message}) print(user) return render(request, "welcome.html", {"e":email}) def signIn(request): return render(request, "signIn.html") I… Read More Why is my Aleart Message not appearing after the user login wasn't correct? Django, html, css

Notifications not showing on list

I have a django app with django-notifications-hq installed. The notifications are working pretty well except for the list of notifications aren’t showing on the field. The notifications count is showing in the navbar. Here’s my code : <div class="dropdown"> <button class="btn btn-link dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false"> <svg xmlns="http://www.w3.org/2000/svg&quot; width="16" height="16" fill="currentColor" class="bi bi-bell" viewBox="0… Read More Notifications not showing on list

Getting invalid name(s) given in select related

I am getting the error invalid field name(s) given in select_related: ‘author_set’. Choices are : first_name, last_name, city, state, country Below are my models: class Author(models.Model): first_name = models.CharField(null=True, blank=True, max_length=50) last_name = models.CharField(null=True, blank=True, max_length=50) city = models.CharField(null=True, blank=True, max_length=50) state = models.CharField(null=True, blank=True, max_length=50) country = models.CharField(null=True, blank=True, max_length=50) class Book(models.Model): author =… Read More Getting invalid name(s) given in select related

How can I tell Django not to load a certain column from the DB

I’m beginning to learn more about improve my app’s performance, and I know while querying I can tell Django to only load the columns I want from the db by using only like the code below: book = Books.objects.only(“author”, “title”) What if I want Django to retrieve books but not retrieve the narration column. Please… Read More How can I tell Django not to load a certain column from the DB

django.db.utils.ProgrammingError: relation "iptoc" does not exist

I have seen all of the similarly titled questions. Case is different: The problem arises when running the unittest. I had to import some foreign tables because they already had data in them (country region city ) data. So I had to create the Model as managed = false class Iptoc(models.Model): id_ip = models.IntegerField(primary_key=True) ip_from… Read More django.db.utils.ProgrammingError: relation "iptoc" does not exist

Django product variation model – how to get distinct color

I am building a ecommerse store with django. One of the requirement is that a product can have a color and different sizes. I also want to keep track of the quantity of each size. I can create ProductVariation like product=’test’, size=’small’, color=’red’, quantity=5 , product=’test’, size=’large’, color=’red’, quantity=10. Now in db there are two… Read More Django product variation model – how to get distinct color

Django QuerySet Object Has No Attribute

I’m trying to add a new action to my OrderAdmin class called "order_shipped", whereby it’ll send an email to the customer informing them that their order has been shipped. class OrderAdmin(admin.ModelAdmin): actions = [‘order_shipped’] def order_shipped(self, request, obj): customer_email = obj.customer.email if request.method == ‘POST’: send_mail( ‘Order Shipped’, ‘Your order has been shipped. Please expect… Read More Django QuerySet Object Has No Attribute