split views into app files
This commit is contained in:
@@ -1,3 +1,16 @@
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
from lettings.models import Letting
|
||||||
|
|
||||||
# Create your views here.
|
|
||||||
|
def index(request):
|
||||||
|
lettings_list = Letting.objects.all()
|
||||||
|
context = {'lettings_list': lettings_list}
|
||||||
|
return render(request, 'lettings/index.html', context)
|
||||||
|
|
||||||
|
def letting(request, letting_id):
|
||||||
|
letting = Letting.objects.get(id=letting_id)
|
||||||
|
context = {
|
||||||
|
'title': letting.title,
|
||||||
|
'address': letting.address,
|
||||||
|
}
|
||||||
|
return render(request, 'lettings/letting.html', context)
|
||||||
@@ -1,3 +1,13 @@
|
|||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
from profiles.models import Profile
|
||||||
|
|
||||||
# Create your views here.
|
|
||||||
|
def index(request):
|
||||||
|
profiles_list = Profile.objects.all()
|
||||||
|
context = {'profiles_list': profiles_list}
|
||||||
|
return render(request, 'profiles/index.html', context)
|
||||||
|
|
||||||
|
def profile(request, username):
|
||||||
|
profile = Profile.objects.get(user__username=username)
|
||||||
|
context = {'profile': profile}
|
||||||
|
return render(request, 'profiles/profile.html', context)
|
||||||
Reference in New Issue
Block a user