-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Template update for easy user navigation
- Loading branch information
Showing
5 changed files
with
80 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from django.contrib.auth.forms import UserCreationForm, UserChangeForm | ||
from .models import CustomUser | ||
|
||
class CustomUserCreationForm(UserCreationForm): | ||
class Meta: | ||
model = CustomUser | ||
fields = ('username', 'email', 'bio', 'profile_picture') | ||
|
||
class CustomUserChangeForm(UserChangeForm): | ||
class Meta: | ||
model = CustomUser | ||
fields = ('username', 'email', 'bio', 'profile_picture') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
# accounts/urls.py | ||
from django.urls import path, include | ||
from rest_framework.routers import DefaultRouter | ||
from .views import UserViewSet, follow_user, unfollow_user | ||
from django.urls import path | ||
from . import views | ||
|
||
router = DefaultRouter() | ||
router.register(r'users', UserViewSet) | ||
|
||
urlpatterns = [ | ||
path('', include(router.urls)), | ||
path('follow/<int:user_id>/', follow_user, name='follow-user'), | ||
path('unfollow/<int:user_id>/', unfollow_user, name='unfollow-user'), | ||
path('users/', views.UserListView.as_view(), name='user-list'), | ||
path('users/<int:pk>/', views.UserDetailView.as_view(), name='user-detail'), | ||
path('users/create/', views.UserCreateView.as_view(), name='user-create'), | ||
path('users/update/<int:pk>/', views.UserUpdateView.as_view(), name='user-update'), | ||
path('', views.home, name='home'), | ||
path('signup/', views.signup, name='signup'), | ||
path('login/', views.login_view, name='login'), | ||
path('logout/', views.logout_view, name='logout'), | ||
path('profile/<int:user_id>/', views.user_profile, name='user-profile'), | ||
path('profile/<int:user_id>/update/', views.user_update, name='user-update'), | ||
path('profile/<int:user_id>/delete/', views.user_delete, name='user-delete'), | ||
path('follow/<int:user_id>/', views.follow_user, name='follow-user'), | ||
path('unfollow/<int:user_id>/', views.unfollow_user, name='unfollow-user'), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block title %}Delete Profile{% endblock %} | ||
|
||
{% block content %} | ||
<h2>Are you sure you want to delete your profile?</h2> | ||
<p>This action cannot be undone.</p> | ||
<form method="post"> | ||
{% csrf_token %} | ||
<button type="submit" class="btn btn-danger">Delete</button> | ||
</form> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters