I am having an issue with rendering my templates
I have different endpoint for each user register
When I register everything works fine the data is save to the database
But when I register using other routes excepts for Landlord the template is not rendered property. I only got the parent template not the content inside content block
path('accounts/landlord/register',
views.LandlordRegistrationView.as_view(), name='landlord_registration'),
path('accounts/tenant/register',
views.TenantRegistrationView.as_view(), name='tenant_registration'),
path('accounts/vendor/register',
views.VendorRegistrationView.as_view(), name='vendor_registration'),
class UserProfileView(LoginRequiredMixin, AddressCompletenessMixin, views.View):
def __init__(self):
super().__init__()
self.template_name = 'settings/profile/profile.html'
self.context = {
'segment': 'Settings',
'sub': 'User Profile'
}
def get(self, request):
complete_profile = self.check_address_completeness(self.request)
user_profile = UserProfiles.objects.get(user=request.user)
self.context['address'] = UserAddressForm(
instance=user_profile.address)
self.context['details_form'] = UserInformationForm(
instance=request.user)
self.context['complete_profile'] = complete_profile
print(self.context['complete_profile'])
return render(request, self.template_name, self.context)
parent ttemplate
<!DOCTYPE html>
{% load i18n static admin_datta %}
{% get_current_language as LANGUAGE_CODE %}
{% get_current_language_bidi as LANGUAGE_BIDI %}
{% get_direction as direction %}
{% get_admin_setting as admin_setting %}
{% load static %}
<html lang="en">
<head>
{% include 'includes/head.html' %}
<title> Property Management Re-Imagined </title>
<link rel="stylesheet" href="{% static 'assets\css\customStyle.css' %}">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<!-- Bootstrap CDN -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
{% block extrastyle %}{% endblock extrastyle %}
{% block extrahead %}
{% endblock extrahead %}
</head>
<body>
{% block pre_loader %}
{% include 'includes/pre-loader.html' %}
{% endblock pre_loader %}
{% block sidebar %}
{% include 'includes/sidebar.html' %}
{% endblock sidebar %}
{% block header %}
{% include 'includes/navigation.html' %}s
{% endblock header %}
<!-- [ Main Content ] start -->
<div class="pcoded-main-container" style="background-color: #fafafd;">
<div class="pcoded-wrapper">
<div class="pcoded-content">
<div class="pcoded-inner-content">
<!-- [ breadcrumb ] start -->
{% block breadcrumbs %}
{% include 'includes/breadcrumb.html' %}
{% endblock breadcrumbs %}
<!-- [ breadcrumb ] end -->
<div class="main-body">
<div class="page-wrapper">
{% block content %}{% endblock content %}
</div>
</div>
</div>
</div>
</div>
</div>
{% include 'includes/scripts.html' %}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>
{% block extra_js %}
{% endblock extra_js %}
</body>
</html>
Child
{% extends 'layouts/base.html' %}
{% load static %}
{% block content %}
<h4>I am Handsome </h4>
{% with user_profile=request.user.userprofiles %}
{% if user_profile.has_complete_address %}
<div class="alert alert-success d-flex align-items-center align-items-center" role="alert">
<lottie-player src="{% static 'assets/images/hi.json' %}" background="transparent" speed="1"
style="width: 50px; height: 50px;" loop autoplay></lottie-player>
<h4 class="alert-heading pt-2">
Welcome
{{request.user.first_name}} {{request.user.last_name}}!
</h4>
</div>
{% else %}
<div class="alert alert-success" role="alert">
<h4 class="alert-heading">Hi {{request.user.username}}!</h4>
<p>Please continue filling your detail to continue.</p>
</div>
{% endif %}
{% endwith %}
{% for message in messages %}
<div class="alert alert-success" role="alert">
<p{% if message.tags %} class="{{ message.tags }}" {% endif %}>{{ message }}</p>
</div>
{% endfor %}
<div class="d-flex justify-content-start mb-2">
<div class="d-flex align-items-center gap-3">
<a href="{% url 'edit-profile' pk=request.user.pk %}" class="btn text-white px-5 btn-sm button-custom ">Edit
Profile</a>
</div>
</div>
<section>
<div class="row">
<div class="col-sm-8">
<div class="card">
<div class="card-block">
<div class="row">
<div class="col-sm-12 mb-4">
<div class="d-flex text-black justify-content-start align-items-center gap-3">
<div class="flex-shrink-0">
{% if request.user.userprofiles.profile_picture %}
<img src="{{ request.user.userprofiles.profile_picture.url }}" class="rounded-circle"
style="width: 180px; object-fit: cover; height: 180px; " alt="User-Profile-Image"
style="object-fit: cover;">
{% else %}
<img src="https://api.dicebear.com/7.x/initials/svg?seed={{request.user.username}}"
class="rounded-circle" style="width: 180px; object-fit: cover; height: 180px;"
alt="User-Profile-Image">
{% endif %}
</div>
<div class=" justify-content-center align-items-center h-100">
<h2 class="mb-1">{{request.user.first_name}} {{request.user.last_name}}</h2>
<p class="mb-0 pb-1">
<i class="bi bi-envelope-fill"></i>
{{ request.user.username }}
</p>
<p class="m-0"><i class="bi bi-geo-alt-fill"></i> {{ request.user.userprofiles.address.street }},
{{ request.user.userprofiles.address.city }}, {{ request.user.userprofiles.address.state }},
{{ request.user.userprofiles.address.country }}
</p>
<p class="mb-0 pb-1" style="color: #2b2a2a;">
<i class="bi bi-person-fill"></i>
{{ request.user.userprofiles.active_profile_type|title }}
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- [ Main Content ] end -->
<!-- Start addresss -->
<div class="row">
<div class="col-sm-8">
<div class="card">
<div class="card-header ">
<div class="d-flex justify-content-between">
<h5>Address</h5>
</div>
</div>
<div class="card-block">
<div class="row">
<div class="col-sm-12 mb-4">
<form action="" method="post">
{% csrf_token %}
{{ address.as_p }}
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End address -->
<!-- Start edit Details -->
<!-- Modal -->
<div class="modal fade" id="end-profile" tabindex="-1" role="dialog" aria-labelledby="edit-profile-info"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="edit-profile-info">User Information</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form action="" method="post">
{% csrf_token %}
{{details_form.as_p}}
<a href="{% url 'password_reset' %}" class="btn btn-secondary text-white " style="width: 100%;">
Reset Password</a>
<div class="btn-con-submit d-flex justify-content-end">
<button type="submit" class="btn btn-primary button-custom ">Save changes</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- End edit Details -->
<!-- Start edit address -->
<!-- Modal -->
<div class="modal fade" id="end-address" tabindex="-1" role="dialog" aria-labelledby="edit-address-info"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="edit-address-info">Address</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form action="{% url 'address' %}" method="post">
{% csrf_token %}
{{address.as_p}}
<button type="submit" class="btn button-custom text-white" style="width: 100%;">Submit</button>
</form>
</div>
</div>
</div>
</div>
{% endblock content %}
{% block extra_js %}
<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>
<Script>
// var myModal = new bootstrap.Modal(document.getElementById('profileCompleteModal'), {
// keyboard: false
// })
// {% if complete_profile != False %}
// myModal.show()
// {% endif %}
// {% if not request.user.first_name or not request.user.last_name %}
// myModal.show()
// {% endif %}
</Script>
{% endblock extra_js %}