Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev gina #7

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
Nama : Kevin Ivan Eda Radhiyya

NPM : 2201233210

Kelas : PBP B
Ubah
Empty file added akun/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions akun/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions akun/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class AkunConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "akun"
2 changes: 2 additions & 0 deletions akun/deskripsi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
akun ini untuk nampilin dashboard-> kan ada beberapa role yang kenak -> tpai tetep pengguna
ini fungsinya.
Empty file added akun/migrations/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions akun/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
105 changes: 105 additions & 0 deletions akun/templates/dashboard.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<!DOCTYPE html>
<html lang="en">
{% include 'nav.html' %}
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard</title>
</head>

<body>
<h1>Dashboard</h1>
<h2>Informasi Profil Pengguna</h2>
<ul>
<li>Nama: {{ request.session.user_data.nama }}</li>
<li>Email: {{ request.session.user_data.email }}</li>
<!-- kalau dia pengguna cek status langganan -->
{% if not request.session.user_data.is_label %}
{% if request.session.user_data.is_premium %}
<li>Status Langganan: Premium</li>
{% else %}
<li>Status Langganan: Non Premium</li>
{% endif %}
{% endif %}

<!-- next -->
{% if request.session.user_data.is_label%}
<!-- <li>Label: {{ request.session.user_data.is_label}}</li> -->
<li>Kontak: {{user_data.kontak }}</li>
{% endif %}

{% if not request.session.user_data.is_label%}
<li>Kota Asal: {{ user_data.kota_asal }}</li>
{% if request.session.user_data.gender == 0 %}
<li>Gender: Perempuan</li>
{% else %}
<li>Gender: Laki-laki</li>
{% endif%}
<li>Tempat Lahir: {{ user_data.tempat_lahir }}</li>
<li>Tanggal Lahir: {{ user_data.tanggal_lahir }}</li>
{% endif %}
{% if request.session.user_data.roles %}
<li>Role:
{% for role in request.session.user_data.roles %}
{% if not forloop.first %}, {% endif %}
{{ role }}
{% endfor %}
</li>
{% endif %}


{% if not request.session.user_data.is_label and not request.session.user_data.is_artist and not request.session.user_data.is_songwriter and not request.session.user_data.is_podcaster %}
{% if playlists %}
<h2>Daftar Playlist</h2>
<ul>
{% for playlist in playlists %}
<li>{{ playlist }}</li>
{% endfor %}
</ul>
{% else %}
<p>Belum Memiliki Playlist</p>
{% endif %}
{% endif %}

{% if request.session.user_data.is_artist or request.session.user_data.is_songwriter and not request.session.user_data.is_podcaster%}
{% if songs %}
<h2>Daftar Lagu</h2>
<ul>
{% for song in songs %}
<li>{{ song }}</li>
{% endfor %}
</ul>
{% else %}
<p>Belum Memiliki Lagu</p>
{% endif %}

{% endif %}

{% if request.session.user_data.is_podcaster %}
{% if podcasts %}
<h2>Daftar Podcast</h2>
<ul>
{% for podcast in podcasts %}
<li>{{ podcast }}</li>
{% endfor %}
</ul>
{% else %}
<p>Belum Memiliki Podcast</p>
{% endif %}
{% endif %}

{% if request.session.user_data.is_label %}
{% if albums %}
<h2>Daftar Album</h2>
<ul>
{% for album in albums %}
<li>{{ album }}</li>
{% endfor %}
</ul>
{% else %}
<p>Belum Memproduksi Album</p>
{% endif %}
{% endif %}
</body>
</html>
23 changes: 23 additions & 0 deletions akun/templates/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Marmut</title>
<!-- Tambahkan link CSS Bootstrap atau CSS kustom Anda di sini -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-5">
<h1 class="text-center">Marmut - 1</h1>
<div class="text-center mt-4">
<a href="{% url 'akun:login' %}" class="btn btn-primary">Login</a>
<a href="{% url 'akun:register_choice' %}" class="btn btn-secondary">Register</a>
</div>
</div>
<!-- Tambahkan script JavaScript Bootstrap atau script kustom Anda di sini -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>
14 changes: 14 additions & 0 deletions akun/templates/list_tables.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<title>List of Tables</title>
</head>
<body>
<h1>Tables in Database</h1>
<ul>
{% for table in tables %}
<li>{{ table }}</li>
{% endfor %}
</ul>
</body>
</html>
34 changes: 34 additions & 0 deletions akun/templates/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form Login</title>
<!-- Tambahkan link CSS Bootstrap atau CSS kustom Anda di sini -->
</head>
<body>
<!-- {% include 'nav.html' %} -->

<div class="container mt-5">
<div class="row">
<div class="col-md-6 offset-md-3">
<h2 class="text-center">FORM LOGIN</h2>
<form action="{% url 'akun:login' %}" method="post">
{% csrf_token %}
<div class="mb-3">
<label for="email" class="form-label">Email:</label>
<input type="email" class="form-control" id="email" name="email" required>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password:</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<button type="submit" class="btn btn-primary">Log In</button>
</form>
</div>
</div>
</div>

<!-- Tambahkan script JavaScript Bootstrap atau script kustom Anda di sini -->
</body>
</html>
19 changes: 19 additions & 0 deletions akun/templates/register_choice.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% include 'nav.html' %}

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pilihan Registrasi</title>
</head>
<body>
<h2>Pilihan Registrasi</h2>
<p>Silakan pilih peran Anda:</p>
<ul>
<li><a href="{% url 'akun:register_pengguna' %}">Pengguna</a></li>
<li><a href="{% url 'akun:register_label' %}">Label</a></li>
</ul>
</body>
</html>

41 changes: 41 additions & 0 deletions akun/templates/register_label.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!DOCTYPE html>

{% include 'nav.html' %}

<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Register Label</title>
<!-- Tambahkan link CSS Bootstrap atau CSS kustom Anda di sini -->
</head>
<body>
<div class="container mt-5">
<div class="row">
<div class="col-md-6 offset-md-3">
<h2 class="text-center">Register Label</h2>
<form method="post" action="{% url 'akun:register_label' %}">
{% csrf_token %}
<div class="mb-3">
<label for="email" class="form-label">Email:</label>
<input type="email" class="form-control" id="email" name="email" required>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password:</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<div class="mb-3">
<label for="nama" class="form-label">Nama:</label>
<input type="text" class="form-control" id="nama" name="nama" required>
</div>
<div class="mb-3">
<label for="kontak" class="form-label">Kontak:</label>
<input type="text" class="form-control" id="kontak" name="kontak" required>
</div>
<button type="submit" class="btn btn-primary">Register</button>
</form>
</div>
</div>
</div>
</body>
</html>
70 changes: 70 additions & 0 deletions akun/templates/register_pengguna.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!DOCTYPE html>
{% include 'nav.html' %}

<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Register Pengguna</title>
<!-- Tambahkan link CSS Bootstrap atau CSS kustom Anda di sini -->
</head>
<body>
<div class="container mt-5">
<div class="row">
<div class="col-md-6 offset-md-3">
<h2 class="text-center">Register Pengguna</h2>
<form method="post" action="{% url 'akun:register_pengguna' %}">
{% csrf_token %}
<div class="mb-3">
<label for="email" class="form-label">Email:</label>
<input type="email" class="form-control" id="email" name="email" required>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password:</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<div class="mb-3">
<label for="nama" class="form-label">Nama:</label>
<input type="text" class="form-control" id="nama" name="nama" required>
</div>
<div class="mb-3">
<label for="gender" class="form-label">Gender:</label>
<select class="form-control" id="gender" name="gender" required>
<option value="0">Perempuan</option>
<option value="1">Laki-laki</option>
</select>
</div>
<div class="mb-3">
<label for="tempat_lahir" class="form-label">Tempat Lahir:</label>
<input type="text" class="form-control" id="tempat_lahir" name="tempat_lahir" required>
</div>
<div class="mb-3">
<label for="tanggal_lahir" class="form-label">Tanggal Lahir:</label>
<input type="date" class="form-control" id="tanggal_lahir" name="tanggal_lahir" required>
</div>
<div class="mb-3">
<label for="kota_asal" class="form-label">Kota Asal:</label>
<input type="text" class="form-control" id="kota_asal" name="kota_asal" required>
</div>
<div class="mb-3">
<label for="roles" class="form-label">Role:</label>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="Podcaster" id="rolePodcaster" name="role">
<label class="form-check-label" for="rolePodcaster">Podcaster</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="Artist" id="roleArtist" name="role">
<label class="form-check-label" for="roleArtist">Artist</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="Songwriter" id="roleSongwriter" name="role">
<label class="form-check-label" for="roleSongwriter">Songwriter</label>
</div>
</div>
<button type="submit" class="btn btn-primary">Register</button>
</form>
</div>
</div>
</div>
</body>
</html>
3 changes: 3 additions & 0 deletions akun/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
12 changes: 12 additions & 0 deletions akun/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django.urls import path
from .views import *
app_name = 'akun'

urlpatterns = [
path('login/', login_with_postgres, name='login' ),
path('register_choice/', register_choice, name='register_choice'),
path('dashboard/', dashboard, name='dashboard'),
path('register/pengguna/', register_pengguna, name='register_pengguna'),
path('register/label/', register_label, name='register_label'),
path('logout/', logout_view, name='logout'),
]
Loading