add doctstings
This commit is contained in:
@@ -3,6 +3,9 @@ from django.contrib.auth.models import User
|
||||
|
||||
|
||||
class Profile(models.Model):
|
||||
"""
|
||||
Defines a service user
|
||||
"""
|
||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||
favorite_city = models.CharField(max_length=64, blank=True)
|
||||
|
||||
|
||||
@@ -3,12 +3,22 @@ from profiles.models import Profile
|
||||
|
||||
|
||||
def index(request):
|
||||
"""
|
||||
Display the list of all profiles
|
||||
:param request: None
|
||||
:return: render and display template as HTML
|
||||
"""
|
||||
profiles_list = Profile.objects.all()
|
||||
context = {'profiles_list': profiles_list}
|
||||
return render(request, 'profiles/index.html', context)
|
||||
|
||||
|
||||
def profile(request, username):
|
||||
"""
|
||||
Display the detail of a give profile
|
||||
:param request: None
|
||||
:return: render and display template as HTML
|
||||
"""
|
||||
profile = Profile.objects.get(user__username=username)
|
||||
context = {'profile': profile}
|
||||
return render(request, 'profiles/profile.html', context)
|
||||
|
||||
Reference in New Issue
Block a user