Skip to content

Commit

Permalink
removed model changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
anishTP committed Oct 13, 2023
1 parent 9312c93 commit 69aec74
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 59 deletions.
8 changes: 0 additions & 8 deletions funnel/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from collections.abc import Sequence

from pytz import utc
from sqlalchemy import LargeBinary
from sqlalchemy.orm import attribute_keyed_dict
from werkzeug.utils import cached_property

Expand Down Expand Up @@ -192,13 +191,6 @@ class Project(UuidMixin, BaseScopedNameMixin, Model):
read={'all'},
datasets={'primary', 'without_parent', 'related'},
)

thumbnail_image = with_roles(
sa.orm.mapped_column(LargeBinary, nullable=True),
read={'all'},
datasets={'primary', 'without_parent', 'related'},
)

allow_rsvp: Mapped[bool] = with_roles(
sa.orm.mapped_column(sa.Boolean, default=True, nullable=False),
read={'all'},
Expand Down
2 changes: 1 addition & 1 deletion funnel/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
org_data_changed = app_signals.signal('org-data-changed')
team_data_changed = app_signals.signal('team-data-changed')
session_revoked = app_signals.signal('session-revoked')
project_data_change = app_signals.signal('project_data_change')
project_data_change = app_signals.signal('project-data-change')

# Commentset role change signals (sends user, document)
project_role_change = app_signals.signal('project_role_change')
Expand Down
9 changes: 4 additions & 5 deletions funnel/views/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,12 @@ def new_project(self) -> ReturnView:
project = Project(created_by=current_auth.user, account=self.obj)
form.populate_obj(project)
project.make_name()
# trigger signal to generate thumbnail image
project_data_change.send(self.obj)
db.session.add(project)
db.session.commit()

flash(_("Your new project has been created"), 'info')

# trigger signal to generate thumbnail image
project_data_change.send(self.obj)
# tag locations
tag_locations.queue(project.id)

Expand Down Expand Up @@ -454,11 +453,11 @@ def edit(self) -> ReturnView:
form = ProjectForm(obj=self.obj, account=self.obj.account, model=Project)
if form.validate_on_submit():
form.populate_obj(self.obj)
# trigger signal to generate thumbnail image
project_data_change.send(self.obj)
db.session.commit()
flash(_("Your changes have been saved"), 'info')
tag_locations.queue(self.obj.id)
# trigger signal to generate thumbnail image
project_data_change.send(self.obj)

# Find and delete draft if it exists
if self.get_draft() is not None:
Expand Down
16 changes: 16 additions & 0 deletions funnel/views/thumnbnails.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""View for autogenerating thumbnail previews."""

from __future__ import annotations

from ..models import Project
from ..signals import project_data_change


@project_data_change.connect
def generate_thumbnail_image(project: Project) -> None:
render_thumbnail_image(project=project)


def render_thumbnail_image(project: Project) -> None:
"""Render the thumbnail image and cache the file using a background task"""
pass

This file was deleted.

0 comments on commit 69aec74

Please sign in to comment.