Browse Source

Update project list

pull/10/head
Hironsan 6 years ago
parent
commit
1598959bf3
6 changed files with 13 additions and 1 deletions
  1. BIN
      app/db.sqlite3
  2. 12
      app/server/models.py
  3. BIN
      app/server/static/images/cat-1045782_640.jpg
  4. BIN
      app/server/static/images/cat-3449999_640.jpg
  5. BIN
      app/server/static/images/tiger-768574_640.jpg
  6. 2
      app/server/templates/projects.html

BIN
app/db.sqlite3

12
app/server/models.py

@ -2,6 +2,7 @@ import string
from django.core.exceptions import ValidationError
from django.db import models
from django.contrib.auth.models import User
from django.contrib.staticfiles.storage import staticfiles_storage
class Project(models.Model):
@ -26,6 +27,17 @@ class Project(models.Model):
def is_type_of(self, project_type):
return project_type == self.project_type
@property
def image(self):
if self.is_type_of(self.DOCUMENT_CLASSIFICATION):
url = staticfiles_storage.url('images/cat-1045782_640.jpg')
elif self.is_type_of(self.SEQUENCE_LABELING):
url = staticfiles_storage.url('images/cat-3449999_640.jpg')
elif self.is_type_of(self.Seq2seq):
url = staticfiles_storage.url('images/tiger-768574_640.jpg')
return url
def __str__(self):
return self.name

BIN
app/server/static/images/cat-1045782_640.jpg

Before After
Width: 640  |  Height: 437  |  Size: 132 KiB

BIN
app/server/static/images/cat-3449999_640.jpg

Before After
Width: 640  |  Height: 426  |  Size: 79 KiB

BIN
app/server/static/images/tiger-768574_640.jpg

Before After
Width: 640  |  Height: 426  |  Size: 82 KiB

2
app/server/templates/projects.html

@ -53,7 +53,7 @@
<div class="card is-shady">
<div class="card-image">
<figure class="image is-4by3">
<img src="https://source.unsplash.com/RWnpyGtY1aU" alt="Placeholder image" class="modal-button" data-target="modal-image2">
<img src="{{ project.image }}" alt="Placeholder image" class="modal-button" data-target="modal-image2">
</figure>
</div>
<div class="card-content">

Loading…
Cancel
Save