top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to write views functions in Django?

+1 vote
244 views

Hi,

Please, I'm working on a dashboard project and so far I am facing challenges when it comes to writing functions for my views.

The difficulty here is, how do I write functions for different parts on a template.

For instance, I want to write a function that takes a user to his profile. How do I do that?

So far this is what I came up with:

@login_required
def show_profile:
  if request.method ==GET:
   return(render, '/profile.html/')
  else:
   return (render, '/login.html/')
posted Oct 30, 2018 by Uncle Sherlock

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
0 votes

I'm new to Django. Is there any tell how to add a limit filter in Django?

+1 vote

Anyone can explain how to delete or alter existing table in database?

+1 vote

I want to count the number of active user in website and also I have to display their IP Address by using python Django framework.

0 votes

Can anyone help me to generate SQL query from Django query

  • Like below:

Employee.objects.all() => select * from employee

+2 votes

I am trying to learn Django. My initial exercise seems fine. I want to create an API with REST on Django for an interactive Python code. REST framework on Django I am understanding more or less.

I am looking for a simple example to start with. I am using Python 2.7+ on MS-Windows 7 Professional.

If any one may kindly suggest.

...