mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 10:11:09 -05:00
Refactor code structure and remove redundant changes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from .querysets import get_base_park_queryset
|
||||
from apps.core.mixins import HTMXFilterableMixin
|
||||
from .models.location import ParkLocation
|
||||
from apps.media.models import Photo
|
||||
from .models.media import ParkPhoto
|
||||
from apps.moderation.models import EditSubmission
|
||||
from apps.moderation.mixins import (
|
||||
EditSubmissionMixin,
|
||||
@@ -547,12 +547,11 @@ class ParkCreateView(LoginRequiredMixin, CreateView):
|
||||
uploaded_count = 0
|
||||
for photo_file in photos:
|
||||
try:
|
||||
Photo.objects.create(
|
||||
ParkPhoto.objects.create(
|
||||
image=photo_file,
|
||||
uploaded_by=self.request.user,
|
||||
content_type=ContentType.objects.get_for_model(Park),
|
||||
object_id=self.object.id,
|
||||
)
|
||||
park=self.object,
|
||||
) )
|
||||
uploaded_count += 1
|
||||
except Exception as e:
|
||||
messages.error(
|
||||
@@ -718,7 +717,7 @@ class ParkUpdateView(LoginRequiredMixin, UpdateView):
|
||||
uploaded_count = 0
|
||||
for photo_file in photos:
|
||||
try:
|
||||
Photo.objects.create(
|
||||
ParkPhoto.objects.create(
|
||||
image=photo_file,
|
||||
uploaded_by=self.request.user,
|
||||
content_type=ContentType.objects.get_for_model(Park),
|
||||
|
||||
Reference in New Issue
Block a user