These are chat archives for django/django

15th
Jul 2017
delirious44
@delirious44
Jul 15 2017 11:44
hey guys
is anyone here ?
where do I put requirements.txt in the tree, and how do I know what to put in it ?
LuffyKing
@LuffyKing
Jul 15 2017 13:01
Are u using a virtual env
?
delirious44
@delirious44
Jul 15 2017 13:03
no
LuffyKing
@LuffyKing
Jul 15 2017 13:03
Use one
Then follow the steps here to deplo
I was there in your exact position last month, was fighting the proper way of doing things. After I followed best practices it saves u so much time.
delirious44
@delirious44
Jul 15 2017 13:06
thanks man... can I use requirements.txt without virtualenv ?
a friend
needs it to see what im up to
LuffyKing
@LuffyKing
Jul 15 2017 13:38
I would say for collaborations try and use git
Then he can just fork whatever u are working on
And use git status and pull
To make updates
Virtual envs say u so much time come deployment
Miracle Ayodele
@iammiracle
Jul 15 2017 14:55
hi guys, i need help on how i can use django along side with javascript
LuffyKing
@LuffyKing
Jul 15 2017 14:58
Just call it the same way u call your CSS files
Miracle Ayodele
@iammiracle
Jul 15 2017 14:59
what i am trying to say is
my snippest is like dis
this
<div class="panel-footer" id="loop">
                                <ul class="post-action">
                                    {% for i in range %}
                                        <button class="btn btn-success" name="hi" id="guess" value="{{ i }}" onclick="transferField(this.value)">{{ i }} </button>
                                    {% endfor %}
                                </ul>
                            </div>
this snippet gives this
if you click on the link you will see an image, and on the image my javascript changes the color when i clicked on it
and changes back when i unclick
but when i click on 1 for example and it changes color, when i click on another number, it does not change color, i guess probably they share the same id
i need each button to act differently
LuffyKing
@LuffyKing
Jul 15 2017 15:03
Ya they do
Since u used the for loop
To make the elements
Miracle Ayodele
@iammiracle
Jul 15 2017 15:04
yeah
LuffyKing
@LuffyKing
Jul 15 2017 15:04
Add I to id
I
i
guess{{I}}
Miracle Ayodele
@iammiracle
Jul 15 2017 15:05
<script>
            clicked = true;
           $(document).on("click", "#guess", function(){
            //do something
              var color = clicked ? '#FF8E2B' : '#27AE60';
                   $(this).css('background-color', color);
                    clicked = !clicked;
            });

          </script>
that's the js
even with guess{{i}}
its not working
LuffyKing
@LuffyKing
Jul 15 2017 15:07
I'm talking about the buttons u made with the for loop
Miracle Ayodele
@iammiracle
Jul 15 2017 15:07
you mean
                                        <button class="btn btn-success" name="hi" id="guess{{ i }}" value="{{ i }}" onclick="transferField(this.value)">{{ i }} </button>
its still not working
LuffyKing
@LuffyKing
Jul 15 2017 15:09
Ya can u repost the HTML part with the changes
Miracle Ayodele
@iammiracle
Jul 15 2017 15:09
<div class="panel-footer" id="loop">
                                <ul class="post-action">
                                    {% for i in range %}
                                        <button class="btn btn-success" name="hi" id="guess{{ i }}" value="{{ i }}" onclick="transferField(this.value)">{{ i }} </button>
                                    {% endfor %}
                                </ul>
                            </div>
LuffyKing
@LuffyKing
Jul 15 2017 15:11
The issue is u are referring to an id
But guess is not an id for any of the elements
Change guess to a class
So change id='guess'
To class='guess'
And on your Js part
Change #guess to .guess
Should work now
Miracle Ayodele
@iammiracle
Jul 15 2017 15:13
what about the class="btn btn-success"
hop both classes wont be a problem
LuffyKing
@LuffyKing
Jul 15 2017 15:14
Lol it will become class='btn btn-success guess'
It should work now
Miracle Ayodele
@iammiracle
Jul 15 2017 15:17
<script>

            clicked = true;

            $(".guess").click(function(){
                var color = clicked ? '#FF8E2B' : '#27AE60';
                $(this).css('background-color', color);
                clicked = !clicked;
            });


        </script>
still behaving the same way
when i click on 5 it changes color
when i clicked on 6, it did not change color because it sees it as unclick event
@LuffyKing hope you understand me
digineo1
@digineo1
Jul 15 2017 18:51
has anyone here used django-allauth and successfully built sort of a "user-profile" using it?
delirious44
@delirious44
Jul 15 2017 21:54
can someone help me with database stuff ?
John
@flyboy1565
Jul 15 2017 22:37
Like what @delirious44
Costantin
@Cosbgn
Jul 15 2017 23:48
Hey everyone
How many current sessions can Django handle?
Is there a limit?
login(request, demo_user)
Can this be called let's say hundreds of times?
Shashank Parekh
@sp1rs
Jul 15 2017 23:56
What is the need of cloning in django queryset?