last day (19 days later) » 

14:33
1
A: Data fetching issues from table which is using jinja2 (django)

Ankit TiwariUse .getlist() if you want to get multiple data from a single key Example 1 def takeattendance(request): if request.method == "POST": subject = Subject.objects.get(id=request.POST['subject']) student_ids = request.POST.getlist('student_name') status = request.POST['sta...

I used 2nd Example but the problem is the attendance is not stored properly if I change the attendance of 1 student it keeps the same for all other students. please help me with it
So you wanted to add attandance for indivisual student from table of students ?
I want by default every thing should be present only the student I make absent should be made absent and should save the data of all at one click after selecting there attendance that is in the bulk same as above
by default every thing should be present only the student I make absent should be made absent - are you selecting students (eg. checkbox) to make them absent ?
No I am using a dropdown toggle which has Present and a Absent option
14:33
Yes, I got that but by default all studets are in your table so if you select absent it will set absent for all students in table if you want to absent specific students then you've to select indivisual student
So if you want to select indivisual students then you've to write javascript for that and have to make a ajax call
Then What method can I use for this to fix may I know please may I get any reference for ajax and javascript please
As I said above you've to write javascript which will collect id's of all selected students & after that you've to make ajax request so that it will send specific id's to server
Can I get that javascript + ajax code please I don't know how to create that
Yes, sure I'll provide that but not in this question becouse it's contain too much code in my answer it will be greate if you ask new question
stackoverflow.com/q/73527304/19492703 here is the new question help me. Please with that code
can u please help
Hello can you please help me @AnkitTiwari
14:35
Hello @Ajay sorry I was at work I'll do it now
Sorry for the Disturbance
@AnkitTiwari do at your free time and help me with it
Yes, I'm doing it noe
now*
wait 5 minutes I'll post an answer
ok
Hey can you show ss of you UI how it looks
I'll share my code but I think your UI is bit confusing so you can update your code as per my answer
Ok sure
14:46
You've added absent and present select tag inside your table in the same table you're looping over students so I'm bit confused about your UI it will helpful if you provide your UI ss
so I can code according to it
-1
Q: Can I get a code for getting id using javascript and ajax

AjayI am new to development and dont have much idea about this please help me, I am unable to get the code for taking id of the absent student using javascript please help me with it. This is my html code where the list of students is displayed, all student by default are present and I if i mark some...

here is the image in question
I have uploaded ss
{% extends 'ms/staff/basic.html' %}

{%block title%} Staff - Student Attendance {%endblock%}

{%block name%} <h3 style="color:white;">Staff > Attendance</h3>{%endblock%}

{%block body%}




<div class="container">
<form method="POST" action="takeattendance">
{% csrf_token %}
<div class="form-group">
<h4 style="color:white;"> Select Subject For Attendance</h4>
<select class="btn btn-success" name="subject">
<option selected disabled="true">Subject</option>
{% for sub in subjects%}
<option value="{{ sub.id }}">{{sub.subject_name}}</option>
This is whole page code
@AnkitTiwari
Ok, Got it thank god you saved my time I was doing it in wrong way
Actually I am new in development I don't have much idea about data structues
I am at my 1st year of engineering
Ok
Hey sorry I bad you there was no need of asking new question UI was not clear to me that's why I told you to do it with Ajax but it was simple mistake I'll update my views.py code in both questions
ok
how much time will it need
@AnkitTiwari
15:03
Don't
Done
Check
Ya wait a min
I can't make duplicate answers so I've added my answer on this question
Thanks sir it worked for me
May I know where can I learn about this functions more
 
2 hours later…
17:01
Hi :)
@Ajay and @AnkitTiwari

  last day (19 days later) »