Manish
yes i dont need redis
Manish
i tried with RequestContext but instead of working it gave me error
R
Cache it
Manish
R
https://docs.djangoproject.com/en/2.1/topics/cache/
Manish
no bro not possible
Rajjix
u can query it once and save to user session, but again that’s a very stupid idea
Manish
R
no bro not possible
Within one minute, you have not even had time to read one of the available caching ways that django provide you
Manish
i am thinking in this from last 15 minute but got no good idea
Rajjix
just write ur custom query sets, makes querying a lot easier, and besides ur db can handle much more cnx than u think, so if u don’t wanna cache it, don’t bother in looking for other ways, they will all be stupid or vurnable in one way or another
R
Mixin + low level cache is the way to go
Manish
actually i did this https://del.dog/usinamivok
Manish
that's why i need solution for preserving objects
R
This sux
Rajjix
Preserving them for what, in case he refreshes the home page? 🤔
George
hi, why can't i make petitions to server when logged in the admin?
Manish
This sux
yes. any good way to do this please tell me.
Manish
Manish
can i use mixin with finction based view?
Manish
George
i didn't understand.
when i make an ajax request to my server, if i am logged in the /admin it spits 403 forbbiden
Manish
R
And home, and contact
Manish
i knew only this way to do that
Manish
tell me if i can optimize it.
Manish
R
.get(pk=1) .first() you should look at django query api documentation
R
And think if you really need to create tables in database for just 1 record...
R
Just put it in the template? 😰
Manish
Just put it in the template? 😰
u didn't understood. i made that so that i can change data of one record from django admin panel and render in template dynamically
Rajjix
There u can display and pass objects from one template to another template using with inside ur curly brackets
For example
{% url ‘some_other_page’ with object %}
Rajjix
Manish
Sanjay Krishnan
Try to make those 3 models into onemodel if its just for one record each
Manish
Manish
Sanjay Krishnan
Can you show your 3 models
Manish
Sanjay Krishnan
You can maybe create a model named configuration and add all your fields in that
Sanjay Krishnan
Then specify it in your settings file and call it whenever you want
Manish
sounds good. i will try this.
Sanjay Krishnan
👍👍
Anders (izzno / gooood) 🇳🇴
@Rajjix @Sin_atra Look at this:
https://github.com/digi604/django-smart-selects
Mirco
Ok now it's clear
And you repeat your query for multiple views because they are inside the footer ?
Manish
Mirco
Have you already thought about context processor ?
Think about static or i18n in your templates , you can make social links and load them in your base template
So you query them inside your settings just once
Something like this
Manish
Mirco
Mi
What would you use to push new data from a django rest backend to a vue frontend, for example? Websockets? Django channels?
Mirco
POST requests ?
Rajjix
i think he’s talking about webhooks
Mi
POST requests ?
But the front end does not know when the django backend has new data, and I don't think polling is a good strategy for this
Mi
I'm talking about pushing data modified or updated by one client (spa) from a backend to another client
Kaio
Hey y'all!
I'm trying to save a M2M multi select field in a CreateView but it's not working at all!
All my fields have been saved but not the M2M.
Do I need to specify something in my view?
That's what I have so far:
Rajjix
you should pass ur model fields in the form meta Class, and see why it’s not saving, you should get an error, to show that error you can add a for loop in your template, for error in form.<m2m_field>.errors then display the error in a span tag or something
Rajjix
or add a form_invalid method and repost the data to the form to check what data is being accepted and what not
Rajjix
or share ur model and form
Danilo
hi guys
Danilo
one question
Danilo
after install Pipefile, i can delete requirements.txt?
Rajjix
yes
Danilo
nice
Danilo
thanks
Anonymous
i want space between two posts here is the code home.html i use bootstrap for card view
Rajjix
class =“card ma-5”
Anonymous
Rajjix
style=“margin:0 10px;”