made a demo version of the project
This commit is contained in:
parent
3ed70ba317
commit
030c03b320
13 changed files with 186 additions and 720 deletions
|
@ -1,3 +1,7 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from .models import UserAccount
|
||||
|
||||
# Register your models here.
|
||||
|
||||
admin.site.register(UserAccount)
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from .models import Album
|
||||
|
||||
# Register your models here.
|
||||
|
||||
class AlbumAdmin(admin.ModelAdmin):
|
||||
list_display = ['id', 'image', 'is_verified']
|
||||
|
||||
admin.site.register(Album, AlbumAdmin)
|
||||
|
|
28
album/migrations/0001_initial.py
Normal file
28
album/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Generated by Django 3.2 on 2022-09-26 00:13
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Album',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('image', models.ImageField(upload_to='')),
|
||||
('is_verified', models.BooleanField(blank=True, default=False)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('modified_at', models.DateTimeField(auto_now=True)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Album',
|
||||
'verbose_name_plural': 'Albums',
|
||||
},
|
||||
),
|
||||
]
|
|
@ -1,3 +1,18 @@
|
|||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
# Create your models here.
|
||||
|
||||
|
||||
class Album(models.Model):
|
||||
image = models.ImageField()
|
||||
is_verified = models.BooleanField(default=False, blank=True)
|
||||
|
||||
# Helpers
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
modified_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Album')
|
||||
verbose_name_plural = _('Albums')
|
||||
ordering = ('-id',)
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from .models import Album
|
||||
|
||||
|
||||
class AlbumCreateUpdateSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Album
|
||||
fields = ('image',)
|
|
@ -1,389 +0,0 @@
|
|||
{% 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 %}
|
|
@ -1,5 +1,7 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% load humanize %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<header>
|
||||
|
@ -48,342 +50,91 @@
|
|||
</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">
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
<div id="message">
|
||||
<div style="padding: 5px;" >
|
||||
<div id="inner-message" class="alert alert-{{message.tags}}" style="margin-bottom: 0px; margin-top: 0px;">
|
||||
{{ message }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<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>
|
||||
<h1 class="jumbotron-heading">Upload Album Photo</h1>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<div class="input-group">
|
||||
<div class="custom-file">
|
||||
<input name="image" type="file" id="image" accept="image/png, image/gif, image/jpeg" >
|
||||
<label id="image-label" class="custom-file-label" for="image">Choose an image</label>
|
||||
</div>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-secondary" type="submit">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</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>
|
||||
|
||||
{% for album in albums %}
|
||||
<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"
|
||||
src="{{ album.image.url }}"
|
||||
alt="Card image cap"
|
||||
style="height: 10rem; width: auto;"
|
||||
/>
|
||||
<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">
|
||||
{% if album.is_verified %}
|
||||
<span class="badge badge-success">Verified</span>
|
||||
{% else %}
|
||||
<span class="badge badge-danger">Unverified</span>
|
||||
{% endif %}
|
||||
{% comment %} <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> {% endcomment %}
|
||||
<small class="text-muted">{{ album.created_at | naturaltime }}</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
<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 %}
|
||||
|
||||
{% block footer %}
|
||||
|
||||
<script>
|
||||
$("#image").change(function(){
|
||||
$("#image-label").text(this.files[0].name);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock footer %}
|
||||
|
|
@ -1,9 +1,13 @@
|
|||
from django.contrib import messages
|
||||
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
|
||||
|
||||
from .models import Album
|
||||
from .serializers import AlbumCreateUpdateSerializer
|
||||
|
||||
# Create your views here.
|
||||
|
||||
class HomePageView(TemplateView):
|
||||
|
@ -14,25 +18,20 @@ class HomePageView(TemplateView):
|
|||
|
||||
# NOTE: This will be used to update the active window in navbar
|
||||
context.update({
|
||||
'contact_us_create': 'active'
|
||||
'contact_us_create': 'active',
|
||||
'albums': Album.objects.all()
|
||||
})
|
||||
|
||||
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)
|
||||
def post(self, request, *args, **kwargs) -> HttpResponse:
|
||||
data = {'image': request.FILES.get('image')}
|
||||
|
||||
# serializer.is_valid(raise_exception=True)
|
||||
# instance = serializer.save()
|
||||
serializer = AlbumCreateUpdateSerializer(data=data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
|
||||
# send_new_inquiry_notification.delay(instance.id)
|
||||
instance = serializer.save()
|
||||
|
||||
# messages.success(self.request, 'Enquiry submitted successfully.')
|
||||
messages.success(self.request, 'Image uploaded successfully.')
|
||||
|
||||
# return HttpResponseRedirect('/dashboard')
|
||||
return HttpResponseRedirect('/')
|
||||
|
|
|
@ -21,6 +21,11 @@ INSTALLED_APPS = [
|
|||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.humanize',
|
||||
|
||||
# Third party apps
|
||||
'rest_framework',
|
||||
'django_extensions',
|
||||
|
||||
# Local apps
|
||||
'accounts',
|
||||
|
@ -28,8 +33,6 @@ INSTALLED_APPS = [
|
|||
'core',
|
||||
'profiles',
|
||||
|
||||
# Third party apps
|
||||
# ....
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
|
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
|
@ -1,3 +1,7 @@
|
|||
from django.contrib import admin
|
||||
|
||||
from .models import UserProfile
|
||||
|
||||
# Register your models here.
|
||||
|
||||
admin.site.register(UserProfile)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
asgiref==3.5.2
|
||||
astroid==2.12.10
|
||||
asttokens==2.0.8
|
||||
autopep8==1.7.0
|
||||
backcall==0.2.0
|
||||
backports.zoneinfo==0.2.1
|
||||
black==22.8.0
|
||||
certifi==2022.9.24
|
||||
|
@ -9,27 +11,46 @@ click==8.1.3
|
|||
decorator==5.1.1
|
||||
dill==0.3.5.1
|
||||
Django==3.2
|
||||
django-filter==22.1
|
||||
djangorestframework==3.14.0
|
||||
executing==1.1.0
|
||||
idna==3.4
|
||||
importlib-metadata==4.12.0
|
||||
ipython==8.5.0
|
||||
isort==5.10.1
|
||||
jedi==0.18.1
|
||||
lazy-object-proxy==1.7.1
|
||||
Markdown==3.4.1
|
||||
matplotlib-inline==0.1.6
|
||||
mccabe==0.7.0
|
||||
mypy-extensions==0.4.3
|
||||
parso==0.8.3
|
||||
pathspec==0.10.1
|
||||
pexpect==4.8.0
|
||||
pickleshare==0.7.5
|
||||
Pillow==9.2.0
|
||||
platformdirs==2.5.2
|
||||
prompt-toolkit==3.0.31
|
||||
ptyprocess==0.7.0
|
||||
pure-eval==0.2.2
|
||||
pycodestyle==2.9.1
|
||||
Pygments==2.13.0
|
||||
pylint==2.15.3
|
||||
python-decouple==3.6
|
||||
pytz==2022.2.1
|
||||
requests==2.27.1
|
||||
six==1.16.0
|
||||
sqlparse==0.4.3
|
||||
stack-data==0.5.1
|
||||
toml==0.10.2
|
||||
tomli==2.0.1
|
||||
tomlkit==0.11.4
|
||||
tqdm==4.64.1
|
||||
traitlets==5.4.0
|
||||
typing-extensions==4.3.0
|
||||
urllib3==1.26.12
|
||||
validators==0.18.2
|
||||
wcwidth==0.2.5
|
||||
weaviate-client==3.8.0
|
||||
wrapt==1.14.1
|
||||
zipp==3.8.1
|
||||
|
|
|
@ -20,6 +20,12 @@
|
|||
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="{% static 'album/css/album.css' %}" rel="stylesheet">
|
||||
|
||||
|
||||
{% block head %}
|
||||
|
||||
{% endblock head %}
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -38,6 +44,9 @@
|
|||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Bootstrap core JavaScript
|
||||
================================================== -->
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
|
@ -49,5 +58,10 @@
|
|||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
||||
|
||||
|
||||
{% block footer %}
|
||||
|
||||
{% endblock footer %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue