Rajjix
Like you’ll have the same data process u should have in any particular AI project u’ve worked with before, just with django or any other web framework u’d be receiving/sending this data through http packets instead of direct input.
Vladyslav 🇺🇦🇪🇺
folks
Anders (izzno / gooood) 🇳🇴
folk
Vladyslav 🇺🇦🇪🇺
need help with forms
Vladyslav 🇺🇦🇪🇺
need to send request to def get_position() in model Group (contrib.auth.model)
Vladyslav 🇺🇦🇪🇺
problem:
Anonymous
<div class="sl-slide-inner" style="background-image: url(img/hero-bg.jpg);"> how to convert this tag to django templates
Sanjay Krishnan
<div class="sl-slide-inner" style="background-image: url({% static 'img/hero-bg.jpg' %});">
Sanjay Krishnan
I think this would do the trick
Sanjay Krishnan
But it is not a good practice to write inline styles
Sanjay Krishnan
And images instead of img as the folder name would be nice 🙂
Anonymous
<div class="sl-slide-inner" style="background-image: url({% static 'img/hero-bg.jpg' %});">
Why do this, since the IMG folder is in the same static folder where the css folder lies. While not give your div a class name, and use the normal background-image in your external style sheet..🤔
Anders (izzno / gooood) 🇳🇴
Ok guys this will be long so feel free to skip it ;) (But please dont) I have a nut that I need help soving. We have a model called ProductItem. I need this model to be able to have different attributes depending on which main attribute it has. So I was thinking of using Jquery/ajax to open choices depending on the choices you make to a dropp down list or something simular. I was thinking to make a model = attribute1 and an attribute2 then depending on what you choose in attribute1 you get a list of attribute2's to choose from/add. The problem I am facing is building a model for attribute1 that has many relationships with attribute2 will ressult in a "shitload" of db requests. Thankfull for any advice / suggestions. If I get this correctly the ProductItem model will have an/or many attribute1`which again has multiple `attribute2. Another way would be to make one main attribute with a "shitload" of boleen fields and just check the the ones that match. Or be "dirty" and add all the attributes to the ProductItem model and expose them as you make choises, but how is adding fields and migrations in production ?
Anders (izzno / gooood) 🇳🇴
Some programs will also access the db directly, but as django has this ORM I need to figure out a "django" way of solving this as well and not just throw it all in one row.
Sanjay Krishnan
Why do this, since the IMG folder is in the same static folder where the css folder lies. While not give your div a class name, and use the normal background-image in your external style sheet..🤔
Yeah thats why I mentioned that writing inline styles is not a good practice..i suggested this solution since he wanted to know how to link it with django templates
Isaías
Good afternoon. How to pass parameters in the django url as follows? Ex: test? Key = jbfljbajshfa
Anders (izzno / gooood) 🇳🇴
You mean like an API ?
Isaías
yes
Anders (izzno / gooood) 🇳🇴
django-rest-api
Rohan
Or you want a variable in url?
Rohan
variable in url
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Anonymous
Hmm
R
I didnt get that
The related_name would just be needed if both relations are to the same model which I don’t think is the case, so let’s say attr1 is category and attr2 subcategory (different models) you could just make a fk from each subcategory to a category and when the user selects a category in your form, perform the ajax request to get all the chosen category associated subcategories to display to the user, then it would depend on your business logic if your ProductItem model has fk’s or m2m to your category/subcategory models
R
I think your application is for local use, but anyways I would make sure to don’t just trust on the front end logic and validate the form on the server side to don’t allow a ‘malicious’ user save subcategories that are not associated to a category by sending raw http requests
Rajjix
but if he’s just using python as a backend api , and a javascript framework on the frontend, wouldn’t it be much easier to just change the select field according to selected category with another fetch or axios request?
Rajjix
I just remember him refering to using an api more than once, hence my theory
R
Yes, that’s what I’m saying but server side validation is also required as you could have users who dont perform requests from the browser, so they could send requests selecting a subcategory which is not related to a subcategory
R
I just remember him refering to using an api more than once, hence my theory
I think the php guy failed (😂) and now he’s building the front end, but not sure thogugh, anyways server side validation would be required
R
It’s never good idea to trust front end validation, as you can easily bypass it by just sending requests through postman or let’s say burp suite or zapproxy as a more advanced tools
R
using php for the front end feels to me like spamming echo everywhere xd
Yeah xD also php is fun because is a language that was born for the web and without a framework such as laravel or symfony, you can’t really do a web, thing that for example in go which was not born thinking with web, you can do by just using standard library
Rajjix
ye that’s a big advantage for php, but with wsgi and awsgi things are really promising for python to take over. considering it’s usability in many other fields, and with the new pwa (progressive web apps) gaining a lot of popularity, i think python and javascript will take over the world 🌎
Anders (izzno / gooood) 🇳🇴
Its down to a PHP needs and i supply...
Anders (izzno / gooood) 🇳🇴
So now I am thinking to add all the attributes to the model and use ajax to "open" the options ? Any other suggestions ?
Anders (izzno / gooood) 🇳🇴
has anyone done something like this ? Multiple choice based on choice.
Anders (izzno / gooood) 🇳🇴
But the important thing here is the demo went well and we have a global project :/ ....
Anders (izzno / gooood) 🇳🇴
Thank you, and THANK YOU... for all your help.
John
gi huys
John
I'am tryng using formset
John
don't success implementation
068089
How to remind when admin's change_form exits
Anonymous
How to correct sentence mistakes in django?.Can we use grammarly api?
Meera
Hi i want to create a django app
Meera
which have choose file button on homepage
Meera
and when one uploads CSV file..the backend reads the file
Meera
and filterout some rows and thier contents and render a table in a view...with these CSV file data
Meera
is it possibe ?
Meera
thank you
Muhammad
Hello Guys, I am new to python. I've seen too many resources to learn. But none of them can keep you attached to the need of learning. So, Is there any book can you advise me by ??
Sanjay Krishnan
simpleisbetterthancomplex.com
Sanjay Krishnan
For django
Muhammad
simpleisbetterthancomplex.com
thanks for the info. anything for python ?
Maz
Anyone worked with Mezzanine CMS?
R
Anyone worked with Mezzanine CMS?
I did, it’s good because everything is built-in and almost doesnt use third party libraries, but it’s a bit outdated and non maintained, if you starting a new project, I would rather suggest checking Wagtail or Django-Cms
Sergei
Hi fellas ! Is there anybody who has inplemented timer to his/her django website? Thanx in advance
Sebastian
Hi, I want to test the following situation: I have a view where I put a request in it. In the request is a User I work with in the view function. At the End of the view function I put a context to the template. When I test this view-function, I want to test the context, the view function is creating. I try to test this with RequestFactory(), because with RequestFactory() I have the possibility to put a user in my request. But it seams that I can not get the context, my view function is creating. Is there a way to test this? I put my case in this document, that you can see what I mean: https://pastebin.com/25Kp8Jfh
Ard
Hii everyone, my name Subhan. I would like to ask you about parsing .shp file (which is generated by arcgis), how to render .shp file with django ? Anyone can help me
Mounikesh
guys i just want to know the difference between aynchronous and synchronous frame2ork i know django is synchronous and framework like tornado is async but couldnt figure out the exact difference between both
Mounikesh
can someone sxplain me this with an example to the context of django and tornado or anyother async frameworks
Anonymous
Try a Google search
Anonymous
Or maybe even there is one by author of Django Channels
R
Think in that talk he does not speak about aiohttp which is a nice asyncio based framework to consider
Anonymous
how to host django for free