Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page not found (404) Request Method: POST #4

Open
neerajkumarsingh17 opened this issue Mar 11, 2019 · 1 comment
Open

Page not found (404) Request Method: POST #4

neerajkumarsingh17 opened this issue Mar 11, 2019 · 1 comment

Comments

@neerajkumarsingh17
Copy link

#urls.py
url(r'^str:course_name/str:user/enrolled_data/', views.enrolled_data, name='enrolled_data'),

#views.py
def enrolled_data(request, user, course_name):
if request.POST: # If this is true, the view received POST
selected_option = request.POST.get('my_options', None)
if selected_option:
enrolled_course = request.POST.get('enroll_course')

    selected_option_user= request.POST.get('my_options_user', None)
    if selected_option:
      enrolled_user = request.POST.get('enrolled_user')

      enrolled = {
        'enrolled_course': enrolled_course,
        'enrolled_user': enrolled_user
      }

return render_to_response("mx-enrollment_new/enrolled_data.html", enrolled)

#html

Courses : % for enroll in course: ${ enroll } % endfor
    <br>
    Select User
    <select  name="user_select" id="selectChoice" >
        <option value="user_all">Select all User</option>
        <option value="user_select">Selected User</option>
    </select>
   
    
    <div id="chechData" name="user_data" title="my_options_user" style="display: none">
        <select name="auth-user" multiple>
            % for user in users:
            <option value="user" name="enrolled_user">${ user }</option>
            % endfor
        </select>
    </div>
    <br>
    <input type="submit" value="Enrolled" />

    </form>





    <script>
    (function($) {
            $('select[name=user_select]').change(function () {
                
                if ($('select[name=user_select] option:selected').val() == 'user_select') {
                    $('#chechData').show();
                   
                } else {
                    $('#chechData').hide();
                }
            });
        }) (jQuery);

    </script>
@neerajkumarsingh17
Copy link
Author

please suggest me how to solve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant