45 changed files with 1238 additions and 30 deletions
@ -0,0 +1,3 @@
|
||||
from django.contrib import admin |
||||
|
||||
# Register your models here. |
@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig |
||||
|
||||
|
||||
class AccountsConfig(AppConfig): |
||||
default_auto_field = 'django.db.models.BigAutoField' |
||||
name = 'accounts' |
@ -0,0 +1,39 @@
|
||||
# Generated by Django 3.2 on 2022-09-25 23:10 |
||||
|
||||
from django.db import migrations, models |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
initial = True |
||||
|
||||
dependencies = [ |
||||
('auth', '0012_alter_user_first_name_max_length'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.CreateModel( |
||||
name='UserAccount', |
||||
fields=[ |
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
||||
('password', models.CharField(max_length=128, verbose_name='password')), |
||||
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), |
||||
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), |
||||
('username', models.CharField(max_length=2555, null=True, unique=True)), |
||||
('email', models.EmailField(max_length=255, unique=True)), |
||||
('first_name', models.CharField(max_length=255)), |
||||
('last_name', models.CharField(max_length=255)), |
||||
('avatar', models.ImageField(blank=True, null=True, upload_to='avatar/')), |
||||
('is_active', models.BooleanField(default=True)), |
||||
('is_staff', models.BooleanField(default=False)), |
||||
('get_newsletter', models.BooleanField(db_index=True, default=True)), |
||||
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), |
||||
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), |
||||
], |
||||
options={ |
||||
'verbose_name': 'User', |
||||
'verbose_name_plural': 'Users', |
||||
'ordering': ['-id'], |
||||
}, |
||||
), |
||||
] |
@ -0,0 +1,74 @@
|
||||
import datetime |
||||
|
||||
from django.conf import settings |
||||
from django.contrib.auth.models import (AbstractBaseUser, BaseUserManager, |
||||
PermissionsMixin) |
||||
from django.db import models |
||||
|
||||
# Create your models here. |
||||
|
||||
class UserAccountManager(BaseUserManager): |
||||
""" Manages the functions needed to create a user """ |
||||
def create_user(self, email, password=None, **extra_fields): |
||||
""" Creates and saves a new user """ |
||||
if not email: |
||||
raise ValueError("Users must have an email address") |
||||
|
||||
email = self.normalize_email(email) |
||||
user = self.model(email=email, **extra_fields) |
||||
|
||||
user.set_password(password) |
||||
user.save(using=self._db) |
||||
|
||||
return user |
||||
|
||||
def create_superuser(self, email, password, **extra_fields): |
||||
user = self.create_user(email, password, **extra_fields) |
||||
|
||||
user.is_superuser = True |
||||
user.is_staff = True |
||||
user.save(using=self._db) |
||||
|
||||
return user |
||||
|
||||
|
||||
class UserAccount(AbstractBaseUser, PermissionsMixin): |
||||
""" General user account fields """ |
||||
|
||||
username = models.CharField(max_length=2555, null=True, unique=True) |
||||
email = models.EmailField(max_length=255, unique=True) |
||||
first_name = models.CharField(max_length=255) |
||||
last_name = models.CharField(max_length=255) |
||||
avatar = models.ImageField(upload_to='avatar/', null=True, blank=True) |
||||
is_active = models.BooleanField(default=True) |
||||
is_staff = models.BooleanField(default=False) |
||||
get_newsletter = models.BooleanField(default=True, db_index=True) |
||||
|
||||
objects = UserAccountManager() |
||||
|
||||
USERNAME_FIELD = "email" |
||||
REQUIRED_FIELDS = ["first_name", "last_name"] |
||||
|
||||
class Meta: |
||||
ordering = ['-id'] |
||||
verbose_name = "User" |
||||
verbose_name_plural = "Users" |
||||
|
||||
|
||||
def get_short_name(self): |
||||
return self.first_name |
||||
|
||||
def __str__(self): |
||||
return self.email |
||||
|
||||
def get_or_create_userprofile(self): |
||||
from profiles.models import UserProfile |
||||
profile, _ = UserProfile.objects.get_or_create(user=self) |
||||
return profile |
||||
|
||||
def get_avatar(self): |
||||
profile = self.get_or_create_userprofile() |
||||
return profile.avatar |
||||
|
||||
|
||||
|
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase |
||||
|
||||
# Create your tests here. |
@ -0,0 +1,8 @@
|
||||
from django.contrib import admin |
||||
from django.urls import include, path |
||||
|
||||
app_name = 'accounts' |
||||
|
||||
urlpatterns = [ |
||||
|
||||
] |
@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render |
||||
|
||||
# Create your views here. |
@ -0,0 +1,3 @@
|
||||
from django.contrib import admin |
||||
|
||||
# Register your models here. |
@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig |
||||
|
||||
|
||||
class AlbumConfig(AppConfig): |
||||
default_auto_field = 'django.db.models.BigAutoField' |
||||
name = 'album' |
@ -0,0 +1,3 @@
|
||||
from django.db import models |
||||
|
||||
# Create your models here. |
@ -0,0 +1,39 @@
|
||||
:root { |
||||
--jumbotron-padding-y: 3rem; |
||||
} |
||||
|
||||
.jumbotron { |
||||
padding-top: var(--jumbotron-padding-y); |
||||
padding-bottom: var(--jumbotron-padding-y); |
||||
margin-bottom: 0; |
||||
background-color: #fff; |
||||
} |
||||
@media (min-width: 768px) { |
||||
.jumbotron { |
||||
padding-top: calc(var(--jumbotron-padding-y) * 2); |
||||
padding-bottom: calc(var(--jumbotron-padding-y) * 2); |
||||
} |
||||
} |
||||
|
||||
.jumbotron p:last-child { |
||||
margin-bottom: 0; |
||||
} |
||||
|
||||
.jumbotron-heading { |
||||
font-weight: 300; |
||||
} |
||||
|
||||
.jumbotron .container { |
||||
max-width: 40rem; |
||||
} |
||||
|
||||
footer { |
||||
padding-top: 3rem; |
||||
padding-bottom: 3rem; |
||||
} |
||||
|
||||
footer p { |
||||
margin-bottom: .25rem; |
||||
} |
||||
|
||||
.box-shadow { box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); } |
@ -0,0 +1,389 @@
|
||||
{% extends 'base.html' %} |
||||
|
||||
{% block content %} |
||||
|
||||
<header> |
||||
<div class="collapse bg-dark" id="navbarHeader"> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="col-sm-8 col-md-7 py-4"> |
||||
<h4 class="text-white">About</h4> |
||||
<p class="text-muted"> |
||||
Add some information about the album below, the author, or any other |
||||
background context. Make it a few sentences long so folks can pick |
||||
up some informative tidbits. Then, link them off to some social |
||||
networking sites or contact information. |
||||
</p> |
||||
</div> |
||||
<div class="col-sm-4 offset-md-1 py-4"> |
||||
<h4 class="text-white">Contact</h4> |
||||
<ul class="list-unstyled"> |
||||
<li><a href="#" class="text-white">Follow on Twitter</a></li> |
||||
<li><a href="#" class="text-white">Like on Facebook</a></li> |
||||
<li><a href="#" class="text-white">Email me</a></li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="navbar navbar-dark bg-dark box-shadow"> |
||||
<div class="container d-flex justify-content-between"> |
||||
<a href="#" class="navbar-brand d-flex align-items-center"> |
||||
<svg |
||||
xmlns="http://www.w3.org/2000/svg" |
||||
width="20" |
||||
height="20" |
||||
viewBox="0 0 24 24" |
||||
fill="none" |
||||
stroke="currentColor" |
||||
stroke-width="2" |
||||
stroke-linecap="round" |
||||
stroke-linejoin="round" |
||||
class="mr-2" |
||||
> |
||||
<path |
||||
d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z" |
||||
></path> |
||||
<circle cx="12" cy="13" r="4"></circle> |
||||
</svg> |
||||
<strong>Album</strong> |
||||
</a> |
||||
<button |
||||
class="navbar-toggler" |
||||
type="button" |
||||
data-toggle="collapse" |
||||
data-target="#navbarHeader" |
||||
aria-controls="navbarHeader" |
||||
aria-expanded="false" |
||||
aria-label="Toggle navigation" |
||||
> |
||||
<span class="navbar-toggler-icon"></span> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
</header> |
||||
|
||||
<main role="main"> |
||||
<section class="jumbotron text-center"> |
||||
<div class="container"> |
||||
<h1 class="jumbotron-heading">Album example</h1> |
||||
<p class="lead text-muted"> |
||||
Something short and leading about the collection belowโits contents, the |
||||
creator, etc. Make it short and sweet, but not too short so folks don't |
||||
simply skip over it entirely. |
||||
</p> |
||||
<p> |
||||
<a href="#" class="btn btn-primary my-2">Main call to action</a> |
||||
<a href="#" class="btn btn-secondary my-2">Secondary action</a> |
||||
</p> |
||||
</div> |
||||
</section> |
||||
|
||||
<div class="album py-5 bg-light"> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</main> |
||||
|
||||
{% endblock content %} |
@ -0,0 +1,389 @@
|
||||
{% extends 'base.html' %} |
||||
|
||||
{% block content %} |
||||
|
||||
<header> |
||||
<div class="collapse bg-dark" id="navbarHeader"> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="col-sm-8 col-md-7 py-4"> |
||||
<h4 class="text-white">About</h4> |
||||
<p class="text-muted"> |
||||
Add some information about the album below, the author, or any other |
||||
background context. Make it a few sentences long so folks can pick |
||||
up some informative tidbits. Then, link them off to some social |
||||
networking sites or contact information. |
||||
</p> |
||||
</div> |
||||
<div class="col-sm-4 offset-md-1 py-4"> |
||||
<h4 class="text-white">Contact</h4> |
||||
<ul class="list-unstyled"> |
||||
<li><a href="#" class="text-white">Follow on Twitter</a></li> |
||||
<li><a href="#" class="text-white">Like on Facebook</a></li> |
||||
<li><a href="#" class="text-white">Email me</a></li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="navbar navbar-dark bg-dark box-shadow"> |
||||
<div class="container d-flex justify-content-between"> |
||||
<a href="#" class="navbar-brand d-flex align-items-center"> |
||||
<svg |
||||
xmlns="http://www.w3.org/2000/svg" |
||||
width="20" |
||||
height="20" |
||||
viewBox="0 0 24 24" |
||||
fill="none" |
||||
stroke="currentColor" |
||||
stroke-width="2" |
||||
stroke-linecap="round" |
||||
stroke-linejoin="round" |
||||
class="mr-2" |
||||
> |
||||
<path |
||||
d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z" |
||||
></path> |
||||
<circle cx="12" cy="13" r="4"></circle> |
||||
</svg> |
||||
<strong>Album</strong> |
||||
</a> |
||||
<button |
||||
class="navbar-toggler" |
||||
type="button" |
||||
data-toggle="collapse" |
||||
data-target="#navbarHeader" |
||||
aria-controls="navbarHeader" |
||||
aria-expanded="false" |
||||
aria-label="Toggle navigation" |
||||
> |
||||
<span class="navbar-toggler-icon"></span> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
</header> |
||||
|
||||
<main role="main"> |
||||
<section class="jumbotron text-center"> |
||||
<div class="container"> |
||||
<h1 class="jumbotron-heading">Album example</h1> |
||||
<p class="lead text-muted"> |
||||
Something short and leading about the collection belowโits contents, the |
||||
creator, etc. Make it short and sweet, but not too short so folks don't |
||||
simply skip over it entirely. |
||||
</p> |
||||
<p> |
||||
<a href="#" class="btn btn-primary my-2">Main call to action</a> |
||||
<a href="#" class="btn btn-secondary my-2">Secondary action</a> |
||||
</p> |
||||
</div> |
||||
</section> |
||||
|
||||
<div class="album py-5 bg-light"> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="col-md-4"> |
||||
<div class="card mb-4 box-shadow"> |
||||
<img |
||||
class="card-img-top" |
||||
data-src="holder.js/100px225?theme=thumb&bg=55595c&fg=eceeef&text=Thumbnail" |
||||
alt="Card image cap" |
||||
/> |
||||
<div class="card-body"> |
||||
<p class="card-text"> |
||||
This is a wider card with supporting text below as a natural |
||||
lead-in to additional content. This content is a little bit |
||||
longer. |
||||
</p> |
||||
<div class="d-flex justify-content-between align-items-center"> |
||||
<div class="btn-group"> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
View |
||||
</button> |
||||
<button |
||||
type="button" |
||||
class="btn btn-sm btn-outline-secondary" |
||||
> |
||||
Edit |
||||
</button> |
||||
</div> |
||||
<small class="text-muted">9 mins</small> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</main> |
||||
|
||||
{% endblock content %} |
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase |
||||
|
||||
# Create your tests here. |
@ -0,0 +1,10 @@
|
||||
from django.contrib import admin |
||||
from django.urls import include, path |
||||
|
||||
from album.views import HomePageView |
||||
|
||||
app_name = 'album' |
||||
|
||||
urlpatterns = [ |
||||
path('', HomePageView.as_view(), name='homepage') |
||||
] |
@ -0,0 +1,38 @@
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin |
||||
from django.core.exceptions import PermissionDenied |
||||
from django.http import HttpResponse, HttpResponseRedirect |
||||
from django.shortcuts import render |
||||
from django.views.generic import CreateView, TemplateView |
||||
|
||||
# Create your views here. |
||||
|
||||
class HomePageView(TemplateView): |
||||
template_name = 'album/homepage.html' |
||||
|
||||
def get_context_data(self, **kwargs): |
||||
context = super().get_context_data(**kwargs) |
||||
|
||||
# NOTE: This will be used to update the active window in navbar |
||||
context.update({ |
||||
'contact_us_create': 'active' |
||||
}) |
||||
|
||||
return context |
||||
|
||||
# def post(self, request, *args, **kwargs) -> HttpResponse: |
||||
# data = { |
||||
# 'user': request.user.id, |
||||
# 'title': request.POST.get('title'), |
||||
# 'description': request.POST.get('description'), |
||||
# 'inquiry_type': request.POST.get('inquiry_type'), |
||||
# } |
||||
# serializer = ContactUsCreateSerializer(data=data) |
||||
|
||||
# serializer.is_valid(raise_exception=True) |
||||
# instance = serializer.save() |
||||
|
||||
# send_new_inquiry_notification.delay(instance.id) |
||||
|
||||
# messages.success(self.request, 'Enquiry submitted successfully.') |
||||
|
||||
# return HttpResponseRedirect('/dashboard') |
@ -1,21 +1,16 @@
|
||||
"""config URL Configuration |
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see: |
||||
https://docs.djangoproject.com/en/3.2/topics/http/urls/ |
||||
Examples: |
||||
Function views |
||||
1. Add an import: from my_app import views |
||||
2. Add a URL to urlpatterns: path('', views.home, name='home') |
||||
Class-based views |
||||
1. Add an import: from other_app.views import Home |
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') |
||||
Including another URLconf |
||||
1. Import the include() function: from django.urls import include, path |
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) |
||||
""" |
||||
from django.conf import settings |
||||
from django.conf.urls.static import static |
||||
from django.contrib import admin |
||||
from django.urls import path |
||||
from django.urls import include, path |
||||
|
||||
urlpatterns = [ |
||||
path('admin/', admin.site.urls), |
||||
path('', include('accounts.urls')), |
||||
path('', include('core.urls')), |
||||
path('', include('album.urls')), |
||||
path('', include('profiles.urls')), |
||||
] |
||||
|
||||
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) |
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |
||||
|
@ -0,0 +1,3 @@
|
||||
from django.contrib import admin |
||||
|
||||
# Register your models here. |
@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig |
||||
|
||||
|
||||
class CoreConfig(AppConfig): |
||||
default_auto_field = 'django.db.models.BigAutoField' |
||||
name = 'core' |
@ -0,0 +1,3 @@
|
||||
from django.db import models |
||||
|
||||
# Create your models here. |
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase |
||||
|
||||
# Create your tests here. |
@ -0,0 +1,8 @@
|
||||
from django.contrib import admin |
||||
from django.urls import include, path |
||||
|
||||
app_name = 'core' |
||||
|
||||
urlpatterns = [ |
||||
|
||||
] |
@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render |
||||
|
||||
# Create your views here. |
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
from django.contrib import admin |
||||
|
||||
# Register your models here. |
@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig |
||||
|
||||
|
||||
class ProfilesConfig(AppConfig): |
||||
default_auto_field = 'django.db.models.BigAutoField' |
||||
name = 'profiles' |
@ -0,0 +1,30 @@
|
||||
# Generated by Django 3.2 on 2022-09-25 23:10 |
||||
|
||||
from django.conf import settings |
||||
from django.db import migrations, models |
||||
import django.db.models.deletion |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
initial = True |
||||
|
||||
dependencies = [ |
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.CreateModel( |
||||
name='UserProfile', |
||||
fields=[ |
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
||||
('avatar', models.ImageField(blank=True, null=True, upload_to='avatar/')), |
||||
('phone_number', models.CharField(blank=True, max_length=100, null=True)), |
||||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), |
||||
], |
||||
options={ |
||||
'verbose_name': 'UserProfile', |
||||
'verbose_name_plural': 'UserProfiles', |
||||
}, |
||||
), |
||||
] |
@ -0,0 +1,31 @@
|
||||
import datetime |
||||
|
||||
from django.db import models |
||||
|
||||
from accounts.models import UserAccount |
||||
|
||||
# Create your models here. |
||||
|
||||
|
||||
class UserProfile(models.Model): |
||||
"""Model definition for UserProfile.""" |
||||
# from order.models import Address |
||||
user = models.OneToOneField(UserAccount, on_delete=models.CASCADE) |
||||
avatar = models.ImageField(upload_to='avatar/', null=True, blank=True) |
||||
phone_number = models.CharField(max_length=100, null=True, blank=True) |
||||
|
||||
class Meta: |
||||
"""Meta definition for UserProfile.""" |
||||
|
||||
verbose_name = 'UserProfile' |
||||
verbose_name_plural = 'UserProfiles' |
||||
|
||||
def __str__(self): |
||||
return self.user.email |
||||
|
||||
def get_shipping_address_data(self): |
||||
return None if not self.shipping_address else self.get_serialized_data(self.shipping_address) |
||||
|
||||
def get_billing_address_data(self): |
||||
return None if not self.billing_address else self.get_serialized_data(self.billing_address)\ |
||||
|
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase |
||||
|
||||
# Create your tests here. |
@ -0,0 +1,8 @@
|
||||
from django.contrib import admin |
||||
from django.urls import include, path |
||||
|
||||
app_name = 'profiles' |
||||
|
||||
urlpatterns = [ |
||||
|
||||
] |
@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render |
||||
|
||||
# Create your views here. |
@ -1,7 +1,35 @@
|
||||
asgiref==3.5.2 |
||||
astroid==2.12.10 |
||||
autopep8==1.7.0 |
||||
backports.zoneinfo==0.2.1 |
||||
black==22.8.0 |
||||
certifi==2022.9.24 |
||||
charset-normalizer==2.0.12 |
||||
click==8.1.3 |
||||
decorator==5.1.1 |
||||
dill==0.3.5.1 |
||||
Django==3.2 |
||||
idna==3.4 |
||||
isort==5.10.1 |
||||
lazy-object-proxy==1.7.1 |
||||
mccabe==0.7.0 |
||||
mypy-extensions==0.4.3 |
||||
pathspec==0.10.1 |
||||
Pillow==9.2.0 |
||||
platformdirs==2.5.2 |
||||
pycodestyle==2.9.1 |
||||
pylint==2.15.3 |
||||
python-decouple==3.6 |
||||
pytz==2022.2.1 |
||||
requests==2.27.1 |
||||
six==1.16.0 |
||||
sqlparse==0.4.3 |
||||
toml==0.10.2 |
||||
tomli==2.0.1 |
||||
tomlkit==0.11.4 |
||||
tqdm==4.64.1 |
||||
typing-extensions==4.3.0 |
||||
urllib3==1.26.12 |
||||
validators==0.18.2 |
||||
weaviate-client==3.8.0 |
||||
wrapt==1.14.1 |
||||
|
@ -0,0 +1,53 @@
|
||||
|
||||
{% load static %} |
||||
|
||||
<!doctype html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
||||
<meta name="description" content=""> |
||||
<meta name="author" content=""> |
||||
<link rel="icon" href="/docs/4.0/assets/img/favicons/favicon.ico"> |
||||
|
||||
<title>Photo Album</title> |
||||
|
||||
<link rel="canonical" href="https://getbootstrap.com/docs/4.0/examples/album/"> |
||||
|
||||
<!-- Bootstrap core CSS --> |
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> |
||||
|
||||
<!-- Custom styles for this template --> |
||||
<link href="{% static 'album/css/album.css' %}" rel="stylesheet"> |
||||
</head> |
||||
|
||||
<body> |
||||
|
||||
{% block content %} |
||||
|
||||
{% endblock content %} |
||||
|
||||
<footer class="text-muted"> |
||||
<div class="container"> |
||||
<p class="float-right"> |
||||
<a href="#">Back to top</a> |
||||
</p> |
||||
<p>Album example is © Bootstrap, but please download and customize it for yourself!</p> |
||||
<p>New to Bootstrap? <a href="../../">Visit the homepage</a> or read our <a href="../../getting-started/">getting started guide</a>.</p> |
||||
</div> |
||||
</footer> |
||||
|
||||
<!-- Bootstrap core JavaScript |
||||
================================================== --> |
||||
<!-- Placed at the end of the document so the pages load faster --> |
||||
{% comment %} <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous" |