-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
kkkkkkkkatya
committed
May 14, 2024
1 parent
b60df8f
commit f4eddf0
Showing
37 changed files
with
342 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
|
@@ -59,7 +59,8 @@ | |
'group', | ||
'user', | ||
'session', | ||
'books' | ||
'books', | ||
'manager', | ||
] | ||
### NEEEEW | ||
|
||
|
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
Binary file not shown.
Binary file not shown.
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,3 +1,6 @@ | ||
from django.contrib import admin | ||
from .models import * | ||
|
||
# Register your models here. | ||
admin.site.register(Forum) | ||
admin.site.register(Discussion) |
Binary file not shown.
Binary file not shown.
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,3 +1,8 @@ | ||
from django.contrib import admin | ||
from .models import * | ||
|
||
# Register your models here. | ||
admin.site.register(Group) | ||
admin.site.register(Interest) | ||
admin.site.register(Comment) | ||
admin.site.register(RelGroupUser) |
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
Binary file not shown.
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
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,3 @@ | ||
|
||
|
||
# Register your models here. |
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,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class AdminConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'manager' |
Empty file.
Binary file not shown.
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,8 @@ | ||
from django.db import models | ||
from django.contrib.auth.models import User | ||
|
||
|
||
|
||
class Manager(models.Model): | ||
user = models.OneToOneField(User, on_delete=models.CASCADE) | ||
is_admin = models.BooleanField(default=False, blank=True, null=True) |
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,50 @@ | ||
{% extends 'main/layout.html' %} | ||
|
||
|
||
{% block content %} | ||
<div class="row mb-3 "> | ||
<div class="col-10"> | ||
<h1>Reading groups</h1> | ||
</div> | ||
{% if user.is_authenticated %} | ||
<div class="col-2"> | ||
<a href="{% url 'group:group_create'%}" class="btn btn-outline-success">Create new group</a> | ||
</div> | ||
{% endif %} | ||
|
||
</div> | ||
{% if error %} | ||
<span class="alert alert-danger mt-2"> {{error}}</span> | ||
{% endif %} | ||
|
||
<div class="container col-10"> | ||
<div class="row justify-content-center"> | ||
{% for el in instance_list %} | ||
<a href="{% url 'manager:group_show' id=el.id %}" class="btn btn-outline-dark mt-3 mb-3"> | ||
<style> | ||
.forum-item { | ||
text-align: left; | ||
} | ||
.topic { | ||
font-size: 30px; /* Adjust font size as needed */ | ||
font-weight: bold; /* Add bold font weight */ | ||
} | ||
.details { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
.name { | ||
margin-right: 10px; /* Add right margin to separate from date */ | ||
} | ||
</style> | ||
<div class="forum-item"> | ||
<p class="topic">{{ el.topic }}</p> | ||
<div class="details"> | ||
<p class="name">#{{ el.interest }}</p> | ||
</div> | ||
</div> | ||
</a> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
{% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
{% extends 'main/layout.html' %} | ||
|
||
{% block content %} | ||
{% if error %} | ||
<span class="alert alert-danger row mt-2">Error! {{error}}</span> | ||
{% endif %} | ||
|
||
<style> | ||
.details { | ||
display: flex; | ||
|
||
} | ||
|
||
.date { | ||
font-style: italic; /* Add italic style to date */ | ||
} | ||
</style> | ||
|
||
<div class="card "> | ||
<div class="card-header bg-dark text-white "> | ||
<p for="creator">Creater: {{ group.creator }}</p> | ||
|
||
{% if user.is_authenticated and user != group.creator%} | ||
|
||
<form method="post"> | ||
{% csrf_token %} | ||
<input type="hidden" name="group_id" value="{{group.id}}"> | ||
<input type="hidden" name="user_id" value="{{user.id}}"> | ||
<div class="row mt-4 mb-4"> | ||
|
||
</div> | ||
</form> | ||
|
||
{% endif %} | ||
|
||
</div> | ||
<div class="card-body position-relative"> | ||
<div> | ||
<h2 class="card-title" style="margin-left: 20px;" for="topic"> {{group.topic}} </h2> | ||
<h6 class="date" style="margin-left: 20px;" for="interest">#{{ group.interest }}</h6> | ||
<h5 class="card-text" style="margin-left: 20px;" for="description"> {{group.description}} </h5> | ||
</div> | ||
<div class="row"> | ||
<div class="col-2 text-right mt-4"> | ||
{% if user.is_staff %} | ||
<a href="{% url 'group:edit' id=group.id %}" class="btn btn-outline-success"><i | ||
class="fa-regular fa-pen-to-square"></i></a> | ||
<a href="{% url 'group:group_delete' id=group.id %}" class="btn btn-outline-danger"><i | ||
class="fa-solid fa-trash-can"></i></a> | ||
{% endif %} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
|
||
<h3>Comments</h3> | ||
{% for el in comments_list %} | ||
<div class="container col-11"> | ||
|
||
<div class="card justify-content-center mt-3 mb-3"> | ||
<div class="card-header bg-dark bg-gradient text-white details"> | ||
<div class="col-9"> | ||
<p for="name"> {{ el.user_id }} | ||
{% if el.parent_comment != None%} | ||
answer {{el.parent_comment.user_id}}: {{el.parent_comment}} | ||
{% endif%} | ||
</p> | ||
</div> | ||
<div class="col-3"> | ||
<p class="date" for="date_created">{{ el.date_created }}</p> | ||
</div> | ||
</div> | ||
<div class="card-body position-relative"> | ||
<div> | ||
<h6 class="card-text" style="margin-left: 20px;" for="discuss"> {{el.comment}} </h6> | ||
{% if user.is_staff %} | ||
<a href="{% url 'group:comment_delete' id=el.id %}" class="btn btn-outline-danger mt-4" | ||
style="margin-left: 20px;"> <i class="fa-solid fa-trash-can"></i></a> | ||
{% endif %} | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
{%endfor%} | ||
|
||
|
||
{% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{% extends 'main/layout.html' %} | ||
|
||
|
||
{% block content %} | ||
<div class="row mb-3 "> | ||
<div class="col-10"> | ||
<h1>Admin dashboard</h1> | ||
</div> | ||
</div> | ||
|
||
{% if error %} | ||
<span class="alert alert-danger mt-2"> {{error}}</span> | ||
{% endif %} | ||
|
||
<div class="container col-10"> | ||
<div class="row justify-content-center"> | ||
<a href="{% url 'manager:group_list' %}" class="btn btn-outline-dark mt-3 mb-3"> | ||
Reading groups | ||
</a> | ||
</div> | ||
<div class="row justify-content-center"> | ||
<a href="{% url 'forum:list' %}" class="btn btn-outline-dark mt-3 mb-3"> | ||
Discussion forums | ||
</a> | ||
</div> | ||
<div class="row justify-content-center"> | ||
<a href="{% url 'manager:users_list' %}" class="btn btn-outline-dark mt-3 mb-3"> | ||
Users | ||
</a> | ||
</div> | ||
</div> | ||
{% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{% extends 'main/layout.html' %} | ||
|
||
|
||
{% block content %} | ||
<div class="row mb-3 "> | ||
<div class="col-10"> | ||
<h1>Users</h1> | ||
</div> | ||
|
||
</div> | ||
{% if error %} | ||
<span class="alert alert-danger mt-2"> {{error}}</span> | ||
{% endif %} | ||
|
||
<div class="container col-10"> | ||
<div class="row justify-content-center"> | ||
{% for el in instance_list %} | ||
<a href="{% url 'user:show' id=el.id %}" class="btn btn-outline-dark mt-3 mb-3"> | ||
<style> | ||
.forum-item { | ||
text-align: left; | ||
} | ||
.topic { | ||
font-size: 30px; /* Adjust font size as needed */ | ||
font-weight: bold; /* Add bold font weight */ | ||
} | ||
.details { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
.name { | ||
margin-right: 10px; /* Add right margin to separate from date */ | ||
} | ||
</style> | ||
<div class="forum-item"> | ||
<p class="topic">{{ el.username }}</p> | ||
<div class="details"> | ||
<p class="name">{{ el.email }}</p> | ||
</div> | ||
</div> | ||
</a> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
{% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
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,17 @@ | ||
from django.urls import path | ||
from . import views | ||
from django.conf import settings | ||
from django.contrib.staticfiles.urls import staticfiles_urlpatterns | ||
|
||
app_name = "manager" | ||
|
||
urlpatterns = [ | ||
path('', views.index, name='home'), | ||
path('users_list', views.users_list, name='users_list'), | ||
path('group_list', views.group_list, name='group_list'), | ||
path('group_show/<int:id>', views.group_show, name='group_show'), | ||
|
||
] | ||
|
||
|
||
urlpatterns += staticfiles_urlpatterns() |
Oops, something went wrong.