roundabout,
created on Monday, 9 September 2024, 09:33:56 (1725874436),
received on Monday, 9 September 2024, 09:59:17 (1725875957)
Author identity: vlad <vlad.muntoiu@gmail.com>
72258ba80356dc21824b04cbde99e1d087de0223
app.py
@@ -75,11 +75,18 @@ with app.app_context():
password_hashed = db.Column(db.String(60), nullable=False) admin = db.Column(db.Boolean, nullable=False, default=False, server_default="false") pictures = db.relationship("PictureResource", back_populates="author") joined_timestamp = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)def __init__(self, username, password): self.username = username self.password_hashed = bcrypt.generate_password_hash(password).decode("utf-8") @property def formatted_name(self): if self.admin: return self.username + "*" return self.username class Licence(db.Model): id = db.Column(db.String(64), primary_key=True) # SPDX identifier
templates/picture.html
@@ -10,6 +10,7 @@
{% block content %} <x-frame style="--width: 768px"> <h1>{{ resource.title }}</h1> <p>by <a href="/profile/{{ resource.author.username }}">{{ resource.author.formatted_name }}</a></p><p>{{ resource.description }}</p> {% if resource.replaced_by %} <h2>Obsolete</h2>
templates/profile.html
@@ -0,0 +1,49 @@
{% extends "default.html" %} {% block title %}{{ user.formatted_name }}'s profile | gigadata{% endblock %} {% block content %} <x-frame style="--width: 768px" class="vbox"> <h1>{{ user.formatted_name }}</h1> <p>Joined: {{ user.joined_timestamp }}</p> <h2>Pictures</h2> <ul class="thumbnail-list"> {% for resource in user.pictures %} <li> <a href="/picture/{{ resource.id }}"> <div class="annotation-zone"> <img src="/raw/picture/{{ resource.id }}" alt="{{ resource.title }}"> {% for region in resource.regions %} {% if region.json.type == "bbox" %} <svg class="shape-container" viewBox="0 0 {{ resource.width }} {{ resource.height }}"> <rect x="{{ region.json.shape.x * resource.width }}" y="{{ region.json.shape.y * resource.height }}" width="{{ region.json.shape.w * resource.width }}" height="{{ region.json.shape.h * resource.height }}" fill="none" class="shape-bbox shape" ></rect> </svg> {% elif region.json.type == "polygon" %} <svg class="shape-container" viewBox="0 0 {{ resource.width }} {{ resource.height }}"> <polygon points="{% for point in region.json.shape %}{{ point.x * resource.width }},{{ point.y * resource.height }} {% endfor %}" fill="none" class="shape-polygon shape"></polygon> </svg> {% elif region.json.type == "polyline" %} <svg class="shape-container" viewBox="0 0 {{ resource.width }} {{ resource.height }}"> <polyline points="{% for point in region.json.shape %}{{ point.x * resource.width }},{{ point.y * resource.height }} {% endfor %}" fill="none" class="shape-polyline shape"></polyline> </svg> {% elif region.json.type == "point" %} <svg class="shape-container" viewBox="0 0 {{ resource.width }} {{ resource.height }}"> <circle cx="{{ region.json.shape.x * resource.width }}" cy="{{ region.json.shape.y * resource.height }}" r="0" fill="none" class="shape-point shape"></circle> </svg> {% endif %} {% endfor %} </div> <div class="list-detail"> {{ resource.title }} </div> </a> </li> {% endfor %} </ul> </x-frame> {% endblock %}