Skip to content

Commit

Permalink
Enhance profile management with dynamic routing and improved user exp…
Browse files Browse the repository at this point in the history
…erience

- Add username-based routing for profile-related views
- Implement dynamic base template selection for admin and non-admin users
- Improve form handling and validation in profile creation and editing
- Add location suggestion feature for address input
- Enhance error handling and messaging in profile management
  • Loading branch information
NagiPragalathan committed Feb 10, 2025
1 parent 6c3c4df commit 81f3999
Show file tree
Hide file tree
Showing 34 changed files with 943 additions and 406 deletions.
Binary file modified QuizApp/__pycache__/settings.cpython-312.pyc
Binary file not shown.
Binary file modified QuizApp/__pycache__/urls.cpython-312.pyc
Binary file not shown.
4 changes: 3 additions & 1 deletion QuizApp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,6 @@
EMAIL_USE_TLS = True

LOGIN_URL = 'login'
LOGIN_REDIRECT_URL = '/'
LOGIN_REDIRECT_URL = '/'

X_FRAME_OPTIONS = 'SAMEORIGIN' # Allows embedding only within the same domain
13 changes: 7 additions & 6 deletions QuizApp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@

profile =[
path('profile/profile_management', profile_management, name='profile_management'),
path('add_profile', add_profile, name='add_profile'),
path('add_contact_details', add_contact_details, name='add_contact_details'),
path('add_edit_user_profile', add_edit_user_profile, name='add_edit_user_profile'),
path('add_or_edit_address', add_or_edit_address, name='add_or_edit_address'),
path('add_or_edit_bio', add_or_edit_bio, name='add_or_edit_bio'),
path('add_edit_user_profile', add_edit_user_profile, name='add_edit_user_profile'), # here we can create new user so this is first tab.
path('add_profile/<str:username>', add_profile, name='add_profile'),
path('add_contact_details/<str:username>', add_contact_details, name='add_contact_details'),
path('add_or_edit_address/<str:username>', add_or_edit_address, name='add_or_edit_address'),
path('add_or_edit_bio/<str:username>', add_or_edit_bio, name='add_or_edit_bio'),
path('delete_image', delete_image, name='delete_image'),
path('add_gallery', add_gallery, name='add_gallery'),
]
Expand Down Expand Up @@ -323,13 +323,14 @@
]

iframe_url = [
path('iframe/', iframe, name='iframe'),
path('iframe/<str:username>', iframe, name='iframe'),
path('email/', email, name='email'),
path('portal/', portal, name='portal'),
]




urlpatterns.extend(auth)
urlpatterns.extend(chat)
urlpatterns.extend(group)
Expand Down
Binary file modified base/__pycache__/admin.cpython-312.pyc
Binary file not shown.
Binary file modified base/__pycache__/models.cpython-312.pyc
Binary file not shown.
Binary file modified base/form/__pycache__/forms.cpython-312.pyc
Binary file not shown.
13 changes: 2 additions & 11 deletions base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,15 @@ class MainProfile(models.Model):
related_name='mainprofile_sponsor'
)
joining_date = models.DateField(blank=True, null=True)

def save(self, *args, **kwargs):
if not self.id: # if the instance is being created
if not self.id: # If instance is being created
self.joining_date = timezone.now().date() # Assign current date to joining_date
super(MainProfile, self).save(*args, **kwargs)

def __str__(self):
return f"{self.title} {self.first_name} {self.last_name}"

def check_membership_status(self):
if self.renewal_due_date and timezone.now().date() > self.renewal_due_date:
self.membership_status = 'Not Active'
self.active_until = self.renewal_due_date
self.save()

@receiver(post_save, sender=MainProfile)
def update_membership_status(sender, instance, **kwargs):
instance.check_membership_status()

class ContactDetails(models.Model):
uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
Expand Down
Binary file modified base/templatetags/__pycache__/djtemp.cpython-312.pyc
Binary file not shown.
Loading

0 comments on commit 81f3999

Please sign in to comment.