-
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.
Merge pull request #3 from Django-Projects-Ls/main
Main
- Loading branch information
Showing
14 changed files
with
283 additions
and
99 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,17 @@ | ||
from django.db.models import ManyToManyField | ||
|
||
def get_field_values(instance): | ||
field_values = {} | ||
fields = instance._meta.get_fields(include_hidden=True) | ||
|
||
for field in fields: | ||
try: | ||
if isinstance(field, ManyToManyField): | ||
related_objects = getattr(instance, field.name).all() | ||
field_values[field.name] = ', '.join(str(obj) for obj in related_objects) | ||
else: | ||
field_values[field.name] = getattr(instance, field.name) | ||
except Exception: | ||
pass | ||
|
||
return field_values |
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
scheduleManagement/migrations/0002_rename_horarioinicio_horario_hora_fim_and_more.py
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,23 @@ | ||
# Generated by Django 4.2.7 on 2023-12-24 13:44 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('scheduleManagement', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name='horario', | ||
old_name='horarioInicio', | ||
new_name='hora_fim', | ||
), | ||
migrations.RenameField( | ||
model_name='horario', | ||
old_name='horarioTermino', | ||
new_name='hora_inicio', | ||
), | ||
] |
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,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-br"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>{{ object_type | capfirst }} | Delete</title> | ||
</head> | ||
<body> | ||
<h1>{{ object_type | capfirst }} | Delete</h1> | ||
|
||
<p>Are you sure you want to delete <strong>{{ object }}?</strong></p> | ||
|
||
<form method="post"> | ||
{% csrf_token %} | ||
<input type="submit" value="Yes, I'm sure"> | ||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,22 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-br"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>{{ object_type | capfirst }} | Update</title> | ||
</head> | ||
<body> | ||
{% if object_type %} | ||
<h1>{{ object_type | capfirst }} | Update</h1> | ||
{% else %} | ||
<h1>Create</h1> | ||
{% endif %} | ||
|
||
<form method="post"> | ||
{% csrf_token %} | ||
{{ form.as_p }} | ||
<input type="submit" value="Save"> | ||
</form> | ||
<a href="{{request.META.HTTP_REFERER}}">Back</a> | ||
</body> | ||
</html> |
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,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-br"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Home page</title> | ||
</head> | ||
<body> | ||
<a href="list-courses"><p>Courses</p></a> | ||
<a href="list-disciplines"><p>Disciplines</p></a> | ||
<a href="list-schedules"><p>Schedules</p></a> | ||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
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,16 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-br"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>{{ object_type | capfirst }} | List</title> | ||
</head> | ||
<body> | ||
<h1>{{ object_type | capfirst }} | List</h1> | ||
{% for object in objects %} | ||
<a href="{{ object.id }}"><p>{{ object }}</p></a> | ||
{% endfor %} | ||
<button onclick="location.href = 'create'">Adicionar {{ object_type }}</button> | ||
<a href="/">Back</a> | ||
</body> | ||
</html> |
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,20 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>{{ object_type | capfirst }} | Details</title> | ||
</head> | ||
<body> | ||
<h1> {{ object_type | capfirst }} | Details</h1> | ||
{% for field, value in object.items %} | ||
<ul> | ||
<li>{{ field }}: {{ value }}</li> | ||
</ul> | ||
{% endfor %} | ||
|
||
<button onclick="location.href = 'edit/{{ object.id }}'" >Update</button> | ||
<button onclick="location.href = 'delete/{{ object.id }}'" >Delete</button> | ||
<a href="/list-{{ object_type }}s">Back</a> | ||
</body> | ||
</html> |
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,12 +1,25 @@ | ||
from django.urls import path | ||
from . import views | ||
from django.views.generic import TemplateView | ||
|
||
urlpatterns = [ | ||
path('', views.MainRequestHandler.as_view(), name='home'), | ||
|
||
path('disciplina/<int:disciplina_id>', views.DisciplinaRequestHandler.as_view(), name='disciplina_details'), | ||
path('', TemplateView.as_view(template_name='home.html'), name='home'), | ||
|
||
path('list-courses/', views.CourseListRequestHandler.as_view(), name='list_courses'), | ||
path('list-courses/create/', views.CourseCreateRequestHandler.as_view(), name='create_course'), | ||
path('list-courses/<int:pk>', views.CourseDetailsRequestHandler.as_view(), name='detail_course'), | ||
path('list-courses/edit/<int:pk>', views.CourseUpdateRequestHandler.as_view(), name='edit_course'), | ||
path('list-courses/delete/<int:pk>', views.CourseDeleteRequestHandler.as_view(), name='delete_course'), | ||
|
||
path('add-course/', views.CourseAddRequestHandler.as_view(), name='add_course'), | ||
path('details/<int:curso_id>', views.DetailsRequestHandler.as_view(), name='curso_details'), | ||
path('edit-course/<int:curso_id>', views.CourseEditRquestHandler.as_view(), name='edit_course'), | ||
path('list-disciplines/', views.DisciplineListRequestHandler.as_view(), name='list_disciplines'), | ||
path('list-disciplines/create/', views.DisciplineCreateRequestHandler.as_view(), name='create_discipline'), | ||
path('list-disciplines/<int:pk>', views.DisciplineDetailsRequestHandler.as_view(), name='detail_discipline'), | ||
path('list-disciplines/edit/<int:pk>', views.DisciplineUpdateRequestHandler.as_view(), name='edit_discipline'), | ||
path('list-disciplines/delete/<int:pk>', views.DisciplineDeleteRequestHandler.as_view(), name='delete_discipline'), | ||
|
||
path('list-schedules/', views.ScheduleListRequestHandler.as_view(), name='list_schedules'), | ||
path('list-schedules/create/', views.ScheduleCreateRequestHandler.as_view(), name='create_schedule'), | ||
path('list-schedules/<int:pk>', views.ScheduleDetailsRequestHandler.as_view(), name='detail_schedule'), | ||
path('list-schedules/edit/<int:pk>', views.ScheduleUpdateRequestHandler.as_view(), name='edit_schedule'), | ||
path('list-schedules/delete/<int:pk>', views.ScheduleDeleteRequestHandler.as_view(), name='delete_schedule'), | ||
] |
Oops, something went wrong.