Artur
Hello. Please tell me the guide on how to display products by category in the online store
Xavier
Hello. Please tell me the guide on how to display products by category in the online store
give that product model one category field or foreign key it and then display it accordingly
Anonymous
hii everyone, can sameone explain me how to use POP3 for printing content-type (body or attachment) please help me..
Abel T.
can someone help me on this tag
Abel T.
<link rel="stylesheet" href="{% static 'website/style.css' %}">
Abel T.
the css is not working
Rishu
if you know about css
Abel T.
yes i know
Rishu
If you know about css
Rishu
This is used to add
Rishu
Css
Rishu
Href here is for path
Rishu
Static here is folder
Rishu
Where all the files kept
Rishu
You must add to settings. Py file
Rishu
Like for db and new app
Rishu
After static
Rishu
Next folder name
Abel T.
the path is correct
Rishu
And file name
Rishu
Path
Rishu
How you add Templates folder
Rishu
Create variable
Abel T.
ok i will thanks for help
Rishu
STATICFILES_DIRS = [ os.path.join (BASE_DIR, 'static')]
Rishu
In settings.py file
Rishu
At the end
Rishu
Below static urls
Shyamkumar
my test not work
Xavier
my test not work
u have any idea how little it narrows the problem down ? share more information
Anonymous
<link rel="stylesheet" href="{% static 'website/style.css' %}">
<link rel="stylesheet" type ="text/css" href="{% static 'website/styles.css' %}">
Anonymous
<link rel="stylesheet" href="{% static 'website/style.css' %}">
<link rel="stylesheet" href="{% static 'website/style.css/' %}"> Try this once and also try hard refresh by ctrl+shift+R
avinash
<link rel="stylesheet" href="{% static 'website/style.css' %}">
If other static files on the web page are also not loading, try to load static in the beginning of the code
Rishu
Start sever again
Rishu
And top of your page
Rishu
Base.html
Rishu
File
Rishu
{% load static %}
Rishu
You have to load static files
Amit
I added on attribute in auth_user table and trying to send data in that attribute but getting error User() got an unexpected keyword argument phone (phone is the attribute that I added in auth_user) can any one help me with this
Amit
If I remove the phone attribute from view then it work perfectly. How can I do this
Amit
https://stackoverflow.com/questions/61825761/raise-typeerrors-got-an-unexpected-keyword-argument-s-cls-name
Mirco
Share the code 😁
Mirco
Checked SO link
Mirco
You need to extend the User model
Mirco
Otherwise you cannot pass that attribute
Александр
Hi, who knows, how get similar id in 2 differents applications in django ?
Александр
🙇‍♂sorry
Anonymous
Can anyone send tutorial for django rest framework social authentication please
Sweetie
Should I use UUID as primary_key? My only concern is I don't want users to find out how many users I have (with AutoField user can know if he registered today and his ID is 1001) I don't want users to attempt accessing data of other users by changing pk in detail/ update / delete urls. Though I do filter queryset with self.request.user But UUID gives an extra layer of safety if I any view does not have the filter. My app will be processing 1000+ queries per second. I have read some benchmark articles which suggests AutoField is 2.5 times to 25 times faster than UUID in MySQL database. My app will be using postgres
utkarsh
Yup, it's a best practice
Bro can you help me out plz
Doragonsureiyā
Bro can you help me out plz
Please don't ask meta questions like: "Any user of $x here?" "Anyone used technology $y?" "Hello I need help on $z" Just ask about your problem directly! With 60k+ people the probability that someone will help is pretty high. Also please read: http://catb.org/~esr/faqs/smart-questions.html
Shyamkumar
(models, forms, apps, tests and singles) which one best method(i know both but best or right) 1st : 'appname' 2nd: 'appname.apps.AppnameConfig'
Shyamkumar
Installapp
Shyamkumar
app name in installed apps and default config in init.py of app
in init.py like this installapp = ["apps.AppnameConfig"]
Muslim
in init.py like this installapp = ["apps.AppnameConfig"]
default_app_config: str = 'appname.apps.AppnameConfig'
Onder
Hello, We're building a django project and we ant to turn on multilanguage web site. But we have some problems. Example while i was developing a blog app, i created a blog model like this; title_en = .. . title_de= ... Is this make sense for multilanguage website? Or should i create app like blog_en, blog_de this. Which one is the better ? If we want to use django trasnlation and localization, we can use it forstatic parts. But we couldn't find out dynamic contents translation, when we use to django_trasnlation
Felipe
Hey guys, hope you're all good! I'm working with Django Rest Framework. I have a model with a date field that is defined as blank = True and null = True. In my serializer I defined this field as required = False and allow_null = True. When the frontend does not send the field or send date = null everything works 100%, however when it sends an empty string "" the serializer raises a validation error. I saw that I can handle this by defining to_internal_value (), but I think there may be a simpler way. Does anyone have any other tips on how to solve this?
Wang
good evening everyone I want to create bookkeeping for self only income and expenditure how to design model who can talk about it
ishak
Where is the correct place for this model? products or users? FavoriteProduct(models.Model) user = models.ForeignKey(User) product = models.ForeignKey(Product)
Anonymous
My images are not displaying on the web page someone have any solution?
Doragonsureiyā
My images are not displaying on the web page someone have any solution?
Please, provide a full explanation including all the details that you consider relevant. Your statement is too broad and there is no clear way to answer you. Include details such as libraries, platforms, modules, etc.
Yakusa
Where is the correct place for this model? products or users? FavoriteProduct(models.Model) user = models.ForeignKey(User) product = models.ForeignKey(Product)
I think that was right. ManyToMany relationship, primary key for each model become foreign key in related model.
Anonymous
class books(models.Model): product_id=models.AutoField book_name=models.CharField(max_length=100) author=models.CharField(max_length=100) subcategory=models.CharField(max_length=100) image=models.ImageField(upload_to='img') price=models.IntegerField() choice=( ('ug',"under graduation"), ('pg','post graduation') ) category=models.CharField(max_length=100,choices=choice) def __str__(self): return self.book_name
Gaurav
"django.db.utils.OperationalError: table "django_content_type" already exists" i get this error when I run migrate command.
Gaurav
how to fix it?
Anonymous
this is my models
Anonymous
<body> <div class="container"> <div id="demo" class="carousel slide" data-ride="carousel"> <ul class="carousel-indicators"> <li data-target="#demo" data-slide-to="0" class="active"></li> {% for i in range%} <li data-target="#demo" data-slide-to="{{i}}"></li> {% endfor %} </ul> <!--slide show starts here--> <div class="container carousel-inner no-padding"> <div class="coursel-item active"> <div class="col-xs-3 col-sm-3 col-md-3" > <div class="card" style="width: 18rem;"> <img src="{{prooduct.0.image}}" class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title">{{prooduct.0.book_name}}</h5> <p class="card-text">{{prooduct.0.author}}</p> <a href="#" class="btn btn-primary">add to cart</a> </div> </div> </div> {% for i in product|slice:"1:"%} <div class="col-xs-3 col-sm-3 col-md-3" > <div class="card" style="width: 18rem;"> <img src="{{i.image}}" class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title" style="color:black;">{{i.book_name}}</h5> <p class="card-text" style="color:black;">{{i.author}}</p> <a href="#" class="btn btn-primary">Add to cart</a> </div> </div> </div> {% if forloop.cpunter|divisibleby:3 and forloop.counter > 0 and not forloop.last %} </div><div class="carousel_item"> {% endif %} {% endfor %} </div> </div> <!--controls --> <a class="carousel-control-prev" href="#demo" data-slide="prev"> <span class="carousel-control-prev-icon"></span> </a> <a class="carousel-control-next" href="#demo" data-slide="next"> <span class="carousel-control-next-icon"></span> </a> {% endblock %} </div> </div> </body>
Anonymous
here i wanted ti display image