Master
> I want to assign methods using the the urls on which it was previously working. What?
Prasanthari
U using same urls for the men n women make separate apps or change path for any of them
Anonymous
> I want to assign methods using the the urls on which it was previously working. What?
I meant this-- my main_site app's urls: path('', views.homePageView, name='home'), path('', views.men, name='men'), path('', views.women, name='women') Here views.men() and views.women()
Master
But both your views render SAME template
Master
So why bother?
Anonymous
U using same urls for the men n women make separate apps or change path for any of them
Is there any way with which i can implement homepage, categories using the same app?
Anonymous
So why bother?
Should i use post request to sent (men or women -- basically category name) to my template ?
Prasanthari
Project Path(' categories/', include (main.site.urls)) N for app Path('men/',views.men) Path('women/',views.women)
Prasanthari
This will generate categories/men Categories/women
Master
> Should i use post request to sent (men or women -- basically category name) to my template ? Ok, now we going to something. Use {{category}} in your 'main_site/products.html' and change render(request, 'main_site/products.html') to render(request, 'main_site/products.html', context={"category":"MAN"})
Anonymous
Now my doubt is cleared.. thanks a lot @Hikaon @PrasanThari for your help. :)
Prasanthari
❤️❤️
Мансур Муҳаммадиев
hello my name is Mansur I am from Uzbekistan, there is a question do you know django web socket video chat or github
Rohan
Can anyone help me with Regex expressesions
Rohan
I want a regex pattern which contains no numbers and contains a-z and A-Z any special character
Anonymous
Why don't you use slug as a parameter imsteyof having different urls and views
Actually, there are only 3 different urls. Is it would be better to use it in this case? I am going to use it in displaying pages with numbering like page-1, page-2 ......
The Summer
Guys i have one question Suppose we are sending queryset Users=User.objects.all() to index.html And we are not using users; index.html is empty So will it still hit database ?
Rishikesh
Do one thing...store that queryset in any variable named q
Rishikesh
And then print... q.query
Rishikesh
You will see the statement used to hit the database
Rishikesh
If you are talking only about template...then there it won't hit
The Summer
No i just wanna know will it hit or not bc some time i have to use silly logics
Prasanthari
If you are talking only about template...then there it won't hit
Yeah that will happen but he's said send it to index,so i said no
The Summer
And what if i print only 1 user ,i have 10k user and check If xuser==user Print xuser
Rishikesh
It will hit...dB......that is equivalent to e.g. "select * from users"
The Summer
not related to html mean
Rishikesh
That checking you can do in template as well....
The Summer
see i send 10k user to template now in template i will do For user in users: If user.id = x: {{x}}
The Summer
So it will take time for 1 record or 10k record
The Summer
Like retrieving data or something i am not able to explain you properly
Rishikesh
The concept of view is that...you have to do all calculations/database queries in views...defined in views.py.....and use the generated results in template (html file)
Rishikesh
So in this way, even if you are using index.html empty or not... it will hit db
Rishikesh
User.objects.all()...is a ORM query... equivalent to Raw SQL query (as a replacement)...😁
The Summer
So in this way, even if you are using index.html empty or not... it will hit db
Thank you, Bro I was bad before I didn't know about the reverse relationship so I used to send all and other stupid things
Rishikesh
Ok so if i send 10k user to template it will gonna hit db whether i use it in template or not
Yes, correct... because already you are querying database using...that queryset statement
Rishikesh
I want a regex pattern which contains no numbers and contains a-z and A-Z any special character
Abhishek that is just a simple raw string, i.e. r"^\D+$". It's for all 1+ characters sequence except numbers.
Rishikesh
Someone who have idea, please help @Horlarwumhe . Why don't you try to host your site for free on Pythonanywhere? It's simple, easy, consise with fully manageable features? I never preferred Heroku...so I can just suggest 😔😊.
Rishikesh
Project Path(' categories/', include (main.site.urls)) N for app Path('men/',views.men) Path('women/',views.women)
I think, the better way would be to use a single view in place of writing 2 views for the urls. URLs will be, e.g. re_path(r"^categories/", include ("app.urls", namespace="app")) Then in app.... re_path(r"^(P<gender>(women|men))/$", views.view_name, name="view-name") Like this.
Lugano
https://stackoverflow.com/questions/35456932/heroku-app-database-resetting
The Summer
Use DRF
Ty i will read about that
Ghorz
Or heliohost.org
The Summer
Or heliohost.org
Bro is there anything which can help to convert Django website into Php😂😂
Ghorz
Heliohost.org support FQDN on free tier, python anywhere free tier only support subdomain
The Summer
Bc I am working on a college project which is in Django but they dont allow anything else than PHP
Ghorz
Bro is there anything which can help to convert Django website into Php😂😂
No at the moment, except you'll build one yourself. It logical to say convert python to php not Django. More like saying can I convert WordPress to Java. Its illogical. 😂
Ghorz
Bc I am working on a college project which is in Django but they dont allow anything else than PHP
Learn php or get someone to do it. If it's not a college project, buy from codecanyon.net
The Summer
Lol I can make in PHP but it will take so much time that I made in Django PHP sucks man
The Summer
BC they taught me PHP in 5th sem not django
The Summer
Why did they stick to php?
Bro i have one more question
The Summer
Can i
The Summer
Ask
Ghorz
BC they taught me PHP in 5th sem not django
Django is not a language, its a framework based on python
Ghorz
Ask
Ask
The Summer
I am working on Question-answer site So how can I display images in an order like User have anwered like in this format Text......etxt........image ..image .....text...text...text...image
The Summer
Like Quora do
Ghorz
Do you mean many image to one text
Ghorz
Or one image per text
Anonymous
Are you sure, you wouldn't prefer to use python?
The Summer
Are you sure, you wouldn't prefer to use python?
It's College project so but i want to be Django developer
The Summer
Anonymous
Ok
Ghorz
Manyimage one text
For Q and A, use DRF
professor
onlie?
Maja Baki
Pls I need help
Luis
Pls I need help
Describe your problem