我已让用户使用Google登录名登录系统,但是每次用户使用Google登录名登录时,它总是重定向到同一位置,但是我想如果用户不是新用户,则应将其重定向到另一个页面。
直到现在,每次用户使用google登录名登录时,它将用户重定向到页面文件上传。 LOGIN_REDIRECT_URL = 'fileupload'
但是我无法将旧用户重定向到另一个位置。
登录重定向网址
LOGIN_REDIRECT_URL = 'fileupload'
html表单
{% load static %}
{% load crispy_forms_tags %}
{% block content %}
<div class="modal fade" id="Modal" aria-labelledby="ModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="Label">User Profile</h5>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<form action="{% url 'uploadprofile' %}" method="POST">
{%csrf_token%}
<div class="form-group">
<input type="hidden" name="username" class="form-control" id="username" value="{{user.username}}" style="font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif" required>
</div>
<div class="form-group">
<label for="contact_no">Contact Number:</label>
<input type="tel" name="contact_no" class="form-control" id="contact_no" placeholder="Contact no." style="font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif" required>
</div>
<div class="form-group">
<label for="dept_no">Department Number:</label>
<select id="dept_no" name="dept_no" class="form-control" style="font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif" required>
<option value="1">Sales</option>
<option value="2">HR</option>
<option value="3">Business Dev.</option>
<option value="4">Engineering</option>
<option value="5">SCM</option>
<option value="6">CSIT</option>
</select>
</div>
<div class="form-group">
<label for="status">Status:</label>
<select id="status" name="status" class="form-control" style="font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif" required>
<option value="0">Active</option>
<option value="1">Inactive</option>
</select>
</div>
<div class="form-group">
<label for="industry_seg">Industry Segment:</label>
<select id="industry_seg" name="industry_seg" class="form-control" style="font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif" required>
<option value="software">Software</option>
<option value="programmer">Programmer</option>
<option value="testing">Testing</option>
</select>
</div>
<div class="form-group">
<label for="created_by">Created By:</label>
<input type="text" value="13" class="form-control" id="created_by" style="font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif" required>
</div>
<div class="form-group">
<label for="updated_by">Updated By:</label>
<input type="text" value="13" class="form-control" id="updated_by" style="font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif" required>
</div>
<div class="modal-footer">
<!--<button type="submit" id="btn-submit" class="btn btn-primary" onclick="saveTags()">Submit</button>-->
<input type="submit" class="btn btn-primary" value="Submit" id="upload">
<input type="reset" value="Reset" class="btn btn-secondary">
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}