Skip to content

Commit

Permalink
Remove the custom JSON encocder
Browse files Browse the repository at this point in the history
  • Loading branch information
edelvalle committed Oct 21, 2021
1 parent b26cf8e commit c095f08
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 44 deletions.
3 changes: 2 additions & 1 deletion djhtmx/component.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
from collections import defaultdict
from itertools import chain

Expand All @@ -9,7 +10,6 @@
from django.utils.functional import cached_property
from pydantic import BaseModel, validate_arguments

from . import json
from .tracing import sentry_span


Expand Down Expand Up @@ -72,6 +72,7 @@ class Config:
json_encoders = {
ComponentMeta: lambda x: None,
models.Model: lambda x: x.pk,
models.QuerySet: lambda qs: qs.values_list('pk', flat=True),
}

def __init_subclass__(cls, name=None, public=True):
Expand Down
41 changes: 0 additions & 41 deletions djhtmx/json.py

This file was deleted.

2 changes: 1 addition & 1 deletion djhtmx/templatetags/htmx.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
from uuid import uuid4

from django import template
Expand All @@ -8,7 +9,6 @@
from django.utils.html import format_html
from django.utils.safestring import mark_safe

from .. import json
from ..component import Component

register = template.Library()
Expand Down
3 changes: 2 additions & 1 deletion djhtmx/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import json

from django.core.signing import Signer
from django.urls import path

from . import json
from .component import Component
from .introspection import filter_parameters, parse_request_data
from .tracing import sentry_request_transaction
Expand Down

0 comments on commit c095f08

Please sign in to comment.