Rebellion
And maybe the urls.py, with that I might help u out
urlpatterns = [ path('search/', search, name='search'), ]
Ing. Mario Tamayo
And the html
Rebellion
And the html
https://pastebin.com/Z31Fum24 Pagination HTML snippet
Ing. Mario Tamayo
I think everything there is on rule, my guess is that in your search form u r making some mistake, maybe the form method is get but your view is expecting some post data
Rebellion
Rebellion
Search functionality is working well, but, pagination is not working for it... If I remove pagination, it shows all the data on single page
Rebellion
Settings.py LOGIN_REDIRECT_URL = 'account:home'
And how come it helps in pagination..?
Carlitos
https://pastebin.com/TmXrFz6a
your search function will work only with POST requests, when you click the paginator you are sending a GET, so what does your function return for a GET request?
Ing. Mario Tamayo
class="page-item"><a class="page-link" href="?page={{i}}">{{i}}</a></li> Do u have any url waiting for this ?page=i request
Carlitos
hello all, btw :)
Ing. Mario Tamayo
Here u r making a get request to the server but the code resolving which page to deliver is inside the request.method post if
Rebellion
class="page-item"><a class="page-link" href="?page={{i}}">{{i}}</a></li> Do u have any url waiting for this ?page=i request
<li class="page-item"><a class="page-link" href="?page={{products.next_page_number}}">Next</a></li>
Ing. Mario Tamayo
But your logic is inside a conditional for the post method
Ing. Mario Tamayo
So when request.method is not post the server will return some nonsense
Ing. Mario Tamayo
This is why almost always is better to maintain search functionalities on the REQUEST.GET scope
Ing. Mario Tamayo
How should i handle it..?
U should make your form method get, then delete the request. Method post if
Ing. Mario Tamayo
Try to just use post for saving data on the server
Akash
I have a get request like Test.com? field=login.start(date).end(date).name("demo") Here I am not able to understand are these multiple parameters or single parameter ?
SUDO
Hi everyone
SUDO
i need your help
SUDO
how to synchronize postgresql database after adding new model in models.py pls help me
SUDO
in dbsqlite can synchronize database with migrate —run-syncdb i need like this script pls
Neo
Are you using multi db?
SUDO
no
Neo
then simply run migrate
SUDO
only 1 user
Neo
I mean do you have multiple databases configured in your settings.py
SUDO
no no only one user in database
SUDO
if i want add new user and how to migrate multi db
SUDO
can anyone answer my question pls
CryptoHunt
Hello friends, help me please I need to give to user notifications when someone wrote message to user or comes on his page Messages creating through django channels and i have an issue with my employee: he said we need to keep websocket connection on everypage and give user automated notifications, without storing them in database But there is a problem, so i need someone to help me: 1) As i know - there is no way to keep websocket connected when user goes on different pages, is that true? 2) Is there grammar way to store notification? Am i doing right by storing them in db?
CryptoHunt
🙃
Poppu
# Create your models here. class CategoryModel(models.Model): name = models.CharField(max_length=255, unique=True) slug = models.SlugField(max_length=255, unique=True) # Create your models here. class TagModel(models.Model): name = models.CharField(max_length=255, unique=True) slug = models.SlugField(max_length=255, unique=True) description = models.TextField(blank=True) category = models.ManyToManyField(CategoryModel, blank=True)
Poppu
I tried inline but it's giving the error there are no forginkey
Mohamad Reza
Mohamad Reza
Your TagModel and CategoryModel are not related to each other
Mohamad Reza
Use ForeignKey
Santhosh
Haii, Actually I'm new to django world, but I practiced n number of project in basics. Any of you can guide me what to do next?
S.H.K
Hi, how used date picker ?
cr
Hi, how used date picker ?
Use jQuery date picker
Santhosh
more complex projects
Can you give me some examples? Bcz I'm confused to select complex projects
Charly
Can you give me some examples? Bcz I'm confused to select complex projects
If you are confuse d then is a good tandidate to choose, I can't say one because I don't know what other things you did before
S.H.K
For large data from django which database is good MySQL community server or PostgresSql ?
Charly
For large data from django which database is good MySQL community server or PostgresSql ?
How large is large? Any is good but the preffered DB (even for django core team) is postgresql
Poppu
Your TagModel and CategoryModel are not related to each other
Isn't any another way i want to many to many fields is there any another way to achieve it's
Charly
Daily 5000 Record
thats not large, its medium
Poppu
Check again what error said!
First of all i doesn't know how can I achieve it's so i do hit and tried. So i use normal foreign key inline method but it's work many to many
chappa
Guys is there any way you can get a client's port number used to access my site?
Банковские карты
Someone explain. Im doing api's in DRF for SPA prj. So, frontend client main page will show: banners, categories, products, stickers and so on. Should i do different serialisers for each of them or it must be one serialised with all objects. Pls tell me.
Javlon
How to activate virtualenv on windows
Charly
How to activate virtualenv on windows
the same as in other OSes
Yaroslav
Hello! I have this problem: 'Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS' Help me, please
KENNEDY
How to activate virtualenv on windows
Cd to venv/bin then "activate"
Yaroslav
What were you trying to do?
I have a database I want to display information from it on the website
Yaroslav
I'm doing lessons on YouTube and at this step I had such a problem. Before that, everything was fine
Anonymous
Is it possible to implement jwt using rest framework and fe using Django template
KENNEDY
I'm doing lessons on YouTube and at this step I had such a problem. Before that, everything was fine
Seems you re trying to query a model from an app that doesn't exist. Maybe seeing your views and models would help
Anonymous
Yes
Can you please guide me to the resource please
Банковские карты
As i know. That's not a good idea to show all objects in one serializer. Write serializer for each of them.
Thanks. How frontend (vue) will get them all together. Do u have an example or some? I need to understand this
Банковские карты
As i know. That's not a good idea to show all objects in one serializer. Write serializer for each of them.
U know, I’m doing kind of a “delivery club” so main clients page will have 15 endpoints and product detail pop up will have at least 5 endpoints. So it should be all separated not nested?
𝕬𝖒𝖎𝖗-𝕸𝖔𝖍𝖆𝖒𝖒𝖆𝖉
Thanks. How frontend (vue) will get them all together. Do u have an example or some? I need to understand this
There are too many examples in github . Your answer: There is no different between the clients in backend. You should just write the api. No matter who is consuming it! If you are going to show products on home page: Write the serializer and show it in "api/products" (example) And also do the same for other in different routes. The vue app should make request call to the routes and show them on home page
Банковские карты
There are too many examples in github . Your answer: There is no different between the clients in backend. You should just write the api. No matter who is consuming it! If you are going to show products on home page: Write the serializer and show it in "api/products" (example) And also do the same for other in different routes. The vue app should make request call to the routes and show them on home page
Thanks u! I already saw GitHub examples and stuff. Tricky thing for me is that clients app main page will have: categories, products, banners, analytics, stickers, about info and so on… so anyway I write separated apis for each as usual and front will merger them all together? Ok, thanks. Sorry, first time building apis for SPA.