Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python - dashboard

// views.py inside APP folder 

def logout(request):
    if request.method == 'POST':
        auth.logout(request)
        messages.success(request, 'You are successfully logged out')
        return redirect('login')

// topbar.html paste code below  

<ul class="top-social-media pull-right">
  {% if user.is_authenticated %}
  <li>
      <a href="{% url 'dashboard'%}" class="sign-in"><i class="fa fa-tachometer"></i> Dashboard</a>
  </li>
  <li>
      <a href="javascript:{document.getElementById('logout').submit()}" class="sign-out"><i class="fa fa-sign-out"></i> Logout</a>
      <form action="{% url 'logout' %}" method="POST" id="logout">
        {% csrf_token %}
        <input type="hidden">
      </form>
  </li>
  {% else %}
    <li>
        <a href="{% url 'login'%}" class="sign-in"><i class="fa fa-sign-in"></i> Login</a>
    </li>
    <li>
        <a href="{% url 'register' %}" class="sign-in"><i class="fa fa-user"></i> Register</a>
    </li>
  {% endif %}
</ul>
  
Comment

PREVIOUS NEXT
Code Example
Python :: shutdown thread python 
Python :: python how to extend a class 
Python :: Change UI within same window PyQt 
Python :: pandas get indices of mask 
Python :: Spatial Reference arcpy 
Python :: how to increment datetime by custom months in python 
Python :: airflow find trigger type 
Python :: iif python 
Python :: how to send message to specific channel discord/py 
Python :: pandascheck if two columns match and populate new column 
Python :: Add dj_database_url on heroku or production 
Python :: loop in coding 1.2 
Python :: python timestamp human readable 
Python :: full_pickle 
Python :: py3-env.bat 
Python :: sns nan matrix 
Python :: def get_context_data(self, **kwargs): 
Python :: RuntimeError: DataLoader worker (pid(s) 13615) exited unexpectedly 
Python :: horney 
Python :: accessing location of a csv cell in python 
Python :: nlp generate parse tree in python 
Python :: discertize dara python 
Python :: get number of occurrences of substring case independent python 
Python :: python matrix condensed to square 
Python :: how to check if a list raises IndexError but wihing a if statement python 
Python :: Percentage change between the current and the prior element. 
Python :: qq plot using seaborn with regression line 
Python :: convert python to java online 
Python :: python min function time complexity 
Python :: Then generate Django project from the project template of cookiecutter 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =