Skip to content

Commit

Permalink
Fix iSort
Browse files Browse the repository at this point in the history
  • Loading branch information
pablodiegoss committed Oct 30, 2024
1 parent e9569e5 commit 0a0c406
Show file tree
Hide file tree
Showing 27 changed files with 71 additions and 34 deletions.
9 changes: 7 additions & 2 deletions locustfile.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
from locust import HttpLocust, Set, between


def index(load):
load.client.get("/")


def load_gifs(load):
load.client.get("/collection/")


def exhibit(load):
load.client.get("/longavida/")


class UserBehavior(Set):
s = {exhibit:1}
s = {exhibit: 1}


class WebsiteUser(HttpLocust):
_set = UserBehavior
wait_time = between(3,5)
wait_time = between(3, 5)
3 changes: 2 additions & 1 deletion src/blog/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from blog.models import Category, Clipping, Post, PostImage
from django.contrib import admin

from blog.models import Category, Clipping, Post, PostImage

admin.site.register(Category)
admin.site.register(PostImage)
admin.site.register(Clipping)
Expand Down
1 change: 1 addition & 0 deletions src/blog/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.core.files.storage import default_storage
from django.db import models

from users.models import Profile

IMAGE_BASE_PATH = "post_images/"
Expand Down
3 changes: 2 additions & 1 deletion src/blog/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# blog/urls.py

from blog import views
from django.urls import path

from blog import views

urlpatterns = [
path("", views.blog_index, name="blog_index"),
path("post/<int:pk>/", views.blog_detail, name="blog_detail"),
Expand Down
3 changes: 2 additions & 1 deletion src/blog/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from blog.models import Category, Clipping, Post, PostStatus
from django.shortcuts import render

from blog.models import Category, Clipping, Post, PostStatus

PREVIEW_SIZE = 300
PAGE_SIZE = 4

Expand Down
7 changes: 7 additions & 0 deletions src/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,12 @@ def debug(request):
SMTP_PASSWORD = env("SMTP_PASSWORD", default="password")
SMTP_SENDER_MAIL = env("SMTP_SENDER_MAIL", default="jandig@memelab.com.br")

# Recaptcha
RECAPTCHA_ENABLED = env("RECAPTCHA_ENABLED", default=False)
RECAPTCHA_SITE_KEY = env("RECAPTCHA_SITE_KEY", default="")
RECAPTCHA_SECRET_KEY = env("RECAPTCHA_SECRET_KEY", default="")
RECAPTCHA_PROJECT_ID = env("RECAPTCHA_PROJECT_ID", default="")
RECAPTCHA_GCLOUD_API_KEY = env("RECAPTCHA_GCLOUD_API_KEY", default="")

if len(sys.argv) > 1 and sys.argv[1] == "test":
logging.disable(logging.CRITICAL)
3 changes: 2 additions & 1 deletion src/core/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from core.models import Artwork, Exhibit, Marker, Object
from django.contrib import admin

from core.models import Artwork, Exhibit, Marker, Object

admin.site.register(Exhibit)
admin.site.register(Object)
admin.site.register(Marker)
Expand Down
3 changes: 2 additions & 1 deletion src/core/models.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import logging
import re

from config.storage_backends import PublicMediaStorage
from django.core.files.base import ContentFile
from django.db import models
from django.db.models.signals import post_delete
from django.dispatch import receiver
from PIL import Image
from pymarker.core import generate_marker_from_image, generate_patt_from_image

from config.storage_backends import PublicMediaStorage
from users.models import Profile

log = logging.getLogger()
Expand Down
3 changes: 2 additions & 1 deletion src/core/serializers/artworks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from core.models import Artwork
from rest_framework.serializers import ModelSerializer

from core.models import Artwork


class ArtworkSerializer(ModelSerializer):
class Meta:
Expand Down
3 changes: 2 additions & 1 deletion src/core/serializers/exhibits.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from core.models import Exhibit
from rest_framework.serializers import ModelSerializer

from core.models import Exhibit


class ExhibitSerializer(ModelSerializer):
class Meta:
Expand Down
3 changes: 2 additions & 1 deletion src/core/serializers/markers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from core.models import Marker
from rest_framework.serializers import ModelSerializer

from core.models import Marker


class MarkerSerializer(ModelSerializer):
class Meta:
Expand Down
3 changes: 2 additions & 1 deletion src/core/serializers/objects.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from core.models import Object
from rest_framework.serializers import ModelSerializer

from core.models import Object


class ObjectSerializer(ModelSerializer):
class Meta:
Expand Down
3 changes: 2 additions & 1 deletion src/core/tests/test_artworks_api.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Test using the artwork API for Jandig Artwork"""

from core.models import Artwork, Marker, Object
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase

from core.models import Artwork, Marker, Object
from users.models import User

fake_file = SimpleUploadedFile("fake_file.png", b"these are the file contents!")
Expand Down
3 changes: 2 additions & 1 deletion src/core/tests/test_exhibits_api.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Test using the exhibit API for Jandig Exhibit"""

from core.models import Artwork, Exhibit, Marker, Object
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase

from core.models import Artwork, Exhibit, Marker, Object
from users.models import User

fake_file = SimpleUploadedFile("fake_file.png", b"these are the file contents!")
Expand Down
5 changes: 3 additions & 2 deletions src/core/tests/test_markers_api.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""Test using the marker API for Jandig Markers"""

from core.models import Marker
from core.serializers.markers import MarkerSerializer
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase

from core.models import Marker
from core.serializers.markers import MarkerSerializer
from users.models import User

fake_file = SimpleUploadedFile("fake_file.png", b"these are the file contents!")
Expand Down
5 changes: 3 additions & 2 deletions src/core/tests/test_objects_api.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""Test using the object API for Jandig Objects"""

from core.models import Object
from core.serializers.objects import ObjectSerializer
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase

from core.models import Object
from core.serializers.objects import ObjectSerializer
from users.models import User

fake_file = SimpleUploadedFile("fake_file.png", b"these are the file contents!")
Expand Down
7 changes: 4 additions & 3 deletions src/core/urls.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from django.conf import settings
from django.urls import include, path
from rest_framework_nested.routers import DefaultRouter

from core.views.artworks import ArtworkViewset
from core.views.exhibits import ExhibitViewset
from core.views.markers import MarkerViewset
Expand All @@ -22,9 +26,6 @@
service_worker,
upload_image,
)
from django.conf import settings
from django.urls import include, path
from rest_framework_nested.routers import DefaultRouter

api_router = DefaultRouter()
api_router.register("markers", MarkerViewset, basename="marker")
Expand Down
5 changes: 3 additions & 2 deletions src/core/views/artworks.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from core.models import Artwork
from core.serializers.artworks import ArtworkSerializer
from rest_framework.mixins import ListModelMixin, RetrieveModelMixin
from rest_framework.viewsets import GenericViewSet

from core.models import Artwork
from core.serializers.artworks import ArtworkSerializer


class ArtworkViewset(ListModelMixin, RetrieveModelMixin, GenericViewSet):
serializer_class = ArtworkSerializer
Expand Down
5 changes: 3 additions & 2 deletions src/core/views/exhibits.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from core.models import Exhibit
from core.serializers.exhibits import ExhibitSerializer
from rest_framework.mixins import ListModelMixin, RetrieveModelMixin
from rest_framework.viewsets import GenericViewSet

from core.models import Exhibit
from core.serializers.exhibits import ExhibitSerializer


class ExhibitViewset(ListModelMixin, RetrieveModelMixin, GenericViewSet):
serializer_class = ExhibitSerializer
Expand Down
5 changes: 3 additions & 2 deletions src/core/views/markers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from core.models import Marker
from core.serializers.markers import MarkerSerializer
from rest_framework.mixins import ListModelMixin, RetrieveModelMixin
from rest_framework.viewsets import GenericViewSet

from core.models import Marker
from core.serializers.markers import MarkerSerializer


class MarkerViewset(ListModelMixin, RetrieveModelMixin, GenericViewSet):
serializer_class = MarkerSerializer
Expand Down
5 changes: 3 additions & 2 deletions src/core/views/objects.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from core.models import Object
from core.serializers.objects import ObjectSerializer
from rest_framework.mixins import ListModelMixin, RetrieveModelMixin
from rest_framework.viewsets import GenericViewSet

from core.models import Object
from core.serializers.objects import ObjectSerializer


class ObjectViewset(ListModelMixin, RetrieveModelMixin, GenericViewSet):
serializer_class = ObjectSerializer
Expand Down
7 changes: 4 additions & 3 deletions src/core/views/views.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from core.forms import ExhibitForm, UploadFileForm
from core.helpers import handle_upload_image
from core.models import Artwork, Exhibit, Marker, Object
from django.core.paginator import Paginator
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse
from django.views.decorators.cache import cache_page
from django.views.decorators.http import require_http_methods

from core.forms import ExhibitForm, UploadFileForm
from core.helpers import handle_upload_image
from core.models import Artwork, Exhibit, Marker, Object


@cache_page(60 * 60)
@require_http_methods(["GET"])
Expand Down
1 change: 1 addition & 0 deletions src/users/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from django.http import HttpRequest
from django.urls import reverse
from django.utils.html import format_html

from users.models import Profile

admin.site.unregister(User)
Expand Down
3 changes: 2 additions & 1 deletion src/users/factory.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from core.models import Object
from django.contrib.auth.models import User
from factory.django import DjangoModelFactory

from core.models import Object


class UserFactory(DjangoModelFactory):
username = "Testador"
Expand Down
3 changes: 2 additions & 1 deletion src/users/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import re
from io import BytesIO

from core.models import Marker, Object
from django import forms
from django.contrib.auth import authenticate, get_user_model
from django.contrib.auth.forms import AuthenticationForm
Expand All @@ -14,6 +13,8 @@
from PIL import Image
from pymarker.core import generate_marker_from_image, generate_patt_from_image

from core.models import Marker, Object

from .choices import COUNTRY_CHOICES

log = logging.getLogger("ej")
Expand Down
1 change: 1 addition & 0 deletions src/users/tests/test_users.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from unittest import mock

from django.test import RequestFactory, TestCase

from users.factory import UserFactory
from users.services.email_service import EmailService
from users.services.encrypt_service import EncryptService
Expand Down
3 changes: 2 additions & 1 deletion tasks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from invoke import task
import os
import sys

from invoke import task

python = sys.executable
directory = os.path.dirname(__file__)
sys.path.append("jandig")
Expand Down

0 comments on commit 0a0c406

Please sign in to comment.