Anonymous
toro khoda ja kon
Remy
I was thinking about keep managing routes and everything with django as I feel quite comfortable with it, just about being able to use vue components and syntax directly in templates within django context, for example use v-for instead of {% for ... %} About the compilation part I know project like nuxtjs/gridsome or vuepress, compile and render all vue components which are not marked as ClientOnly in the backend and then the ones that are marked as client are rendered in the client browser, so it would be about looking how they do it and just integrating it
Well, that's exactly what I do in my project. I use v-for on the pages that I use vuejs. And {% for on the pages I don't use vuejs. I understand better what you mean about compiling vuejs... Well that sounds doable but I don't see an advantage of doing that over just using Django regular template as the compiled response would be static html anyway. Again you can still use vuejs within some django template as I do
Anonymous
Can anyone teach me django forms?
Anonymous
I neee to create a login page and make it login into the website
R
I neee to create a login page and make it login into the website
Some messages ago someone asked the same, otherways just google it, there are tons of resources about it
Alejandro
good, someone has used django-leaflet
Alejandro
???
Doragonsureiyā
good, someone has used django-leaflet
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 47k+ people the probability that someone will help is pretty high. Also please read: http://catb.org/~esr/faqs/smart-questions.html
Opeyemi
https://stackoverflow.com/questions/59110226/implementing-following-and-followers-doesnt-work-properly
professor
Hey guys , i have been digging into twitter / Netflix or Facebook that uses blob format to protect video download by crawlers , nut how can I process a video format as blob ?
R
Hey guys , i have been digging into twitter / Netflix or Facebook that uses blob format to protect video download by crawlers , nut how can I process a video format as blob ?
I think blob format is usually created from the client side and not sure it is really used for protecting videos from crawlers, additionally, you can check nginx rtmp module if u plan to serve large videos
Sari
https://pastebin.com/Ak8PCMPh help me, I will make a payroll application but the results of the payment formula are not saved but not error too. thanks
Anonymous
Hello.. How do we implement a bootstrap modal with a class based view? I have created a DeleteView class to delete an item from the database. The pop-up window appears but it doesn't do anything when I click the submit button. Not sure why. Below is the question with all the code for reference. https://stackoverflow.com/questions/59110714/bootstrap-modal-submit-button-not-working-with-deleteview-in-django-2-2
Anonymous
I neee to create a login page and make it login into the website
You can refer to Django tutorial videos by Corey Schafer on YouTube. He has explained it really well.
Shikhar
You can refer to Django tutorial videos by Corey Schafer on YouTube. He has explained it really well.
Hey I've made a function which is called when I submit the form. It simply adds data to the db. I know about delete view but I want to know how can I connect the button which is present on the form to the delete view class?
Shikhar
I believe in the html, you can add an onclick event to your button to link it to a function.
But that's the syntax of JavaScript. And three delete view is in python
Anonymous
If I understand it right, you want to delete something when you click on a button by using the DeleteView class correct?
Shikhar
Yes. I've multiple entries and each entry has its own delete button. So whenever I clicked on delete button that request should go to view I guess??
Anonymous
That's correct. You write your DeleteView class in your views.py file link it to your button. You need to create a url for it too.
Anonymous
I was trying to implement it using a popup window. When i click the delete button, a pop up window appears and when i click submit from that pop-up, it should use the DeleteView. But don't know how to do it as I am missing something.
Shikhar
Ok
Shikhar
I also want before deleting that data, a script should run on the background which uses those data field. How to do this??
Anonymous
So I can link the button with class using url??
Yes. That's how i would do it but I will let the experts share their views if there are any better ways.
Anonymous
Hey everyone, I have question, I am making a site where I don't need Django login system because the user wants to login he is redirected to Discord and I am using discord Oauth2 api in order to get users code and afterwards his tokens which I can use to access his discord name, profile photo etc.. How would I keep track of each user on my website i need to check on certain pages if user is logged in(by logged in I mean if he has authorized my app on Discord) so basically if he's logged in in Discord and has authorized my app to access his data that should be enough to be logged in on my website, I saw that there is something like request.user but how would I set that using my login system? I need to check if user is logged in on certain pages and not make the user login through Discord each time he uses my site if he's already authorized my app
Orack
https://imgur.com/a/sWWjyCm
Orack
https://imgur.com/a/sWWjyCm
How will its model look like ?
Kiro
i have problem Cannot assign "'1'": "Products.categories" must be a "Category" instance. are you have the same problem with me how to fix this i was search on google and stack overflow but nothing solution
Anonymous
I also want before deleting that data, a script should run on the background which uses those data field. How to do this??
+++ Lord Sipra if you need to execute a script before the delete action (I am assuming it is JS script), create a JS function which get called when the delete button is executed. Do whatever you want first then make an Ajax request to your custom URL to delete the item. refer the docs for more info.
Денис
i have problem Cannot assign "'1'": "Products.categories" must be a "Category" instance. are you have the same problem with me how to fix this i was search on google and stack overflow but nothing solution
you need a single Category object. Products.categories will return a QuerySet of Category objects. You need a specific one, so Products.categories.get(something=anything)
Денис
but i want to create data with createview
then something must be cleared. What kind of relation do you use? If ForeignKey then what is a ForeignKey to what? If ManyToManyField, then the story is somewhat different.
Anonymous
No it's a Python script
then create a simple form for the button to submit to a url. you can place the script in the view or the model depending on what feels right to you
Денис
i use foreign key for relate categories in producs to categories table
The best way to explain what you mean is to show the code. Do I understand correctly that you have categories = ForeignKey(Category, on_delete=models.CASCADE) in it?
Денис
yes
This is probably wrong, as a product may be of many categories at the same time, like a pen may be both writing and drawing instrument. So you'd probably want to use ManyToManyField. Nevetheless, your categories field is now always a Category instance. And what your error says is "Cannot assign '1'", which means you try to do it. But '1' is a string, which means you probably want a specific field of Category to be assigned, rather than Category object itself, the latter is impossible by definition.
Денис
suggestion: category = Category.objects.get(pk=1) #use any field for filtering instead of pk if you need product.category = category product.save()
Денис
yes i know this solve my problem but i use class based view i'm confused to place thats
in CBV you can just override def post(self, request): and go on saving your model.
Shikhar
then create a simple form for the button to submit to a url. you can place the script in the view or the model depending on what feels right to you
Actually I'm receiving data and showing it on the same page. So I've already created a form which is Calling another function of views
Kiro
but fail
Anonymous
use pastebin
Kiro
use pastebin
yes wait i'm sorry
Денис
https://pastebin.com/JFJ8ejW8
I'm not that much into Django forms. But probably you'd want to use choices for categories form field rather than CharField. Also, if you provide a model in Meta, i can't follow your reasons why you provide fields manually at all.
Денис
I can't help you there any further. Read more about Django forms in the docs.
Anonymous
Actually I'm receiving data and showing it on the same page. So I've already created a form which is Calling another function of views
what you need now is a delete form or if that's not possible, use Ajax call for delete function
Sari
post your view
https://pastebin.com/cfUUhfeA
Anonymous
Hi everybody, why doesn't work 'load static '?
Anonymous
https://pastebin.com/cfUUhfeA
I don't see anywhere you are saving data to the model. Is this the correct view?
Anonymous
Anonymous
because {% load staticfiles %}
Yes .It doesn't work .
Anonymous
{% load static %}
does not work on Linux
Anonymous
does not work on Linux
i have linux ant it works 😐
Anonymous
Денис
Yes .It doesn't work .
“Doesn’t work” is useless info. Debug mode on or off? In develop or in production? If second, is your webserver set up for serving static files? If you just get an exception, put it on pastebin.com
Денис
And for god’s sake read the docs on serving static files in django
Dishant
Hey People, Needed help with collectstatic I have successfully completed with that stuff, but when i restart server and visit home page an error is thrown. Value error : Missing staticfiles manifest entry But when i visit to any other page no error is thrown and works perfectly but not on homepage. Any suggestions, why its happening. Thanks 😀
Shikhar
Hey I'm taking the user info through form and showing it in the same page. But whenever I click on the submit button it goes to /function _name even though I've written return render (req, 'home/index.html') still I'm not going to main page My view: https://paste.pics/7DPNF MY URLS : https://paste.pics/7DPYM
Shikhar
In the view you can see there is a function called add_data_db. Whenever I click on submit it stays on /add_data_db
Dishant
Share the html file
Dishant
Shikhar
Lion
Hi everybody
Lion
I have problem with postgis and postgresql version
Shikhar
Share the html file
Here is my template https://pastebin.com/b4zpa2n2
Lion
Who well with postgis