Skip to content

Commit 723cd6e

Browse files
committed
Fixed minor error from queryset operation.
1 parent 05e5e32 commit 723cd6e

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

contact/api_crud.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
class ContactCRUD(BaseCRUD[Contact, ContactCreate, ContactCreate, SLUGTYPE]):
1313

1414
def create(self, obj_in: ContactCreate) -> Contact:
15-
obj_in = jsonable_encoder(obj_in)
16-
query = Category.objects.create(**obj_in)
17-
return query
15+
Contact.objects.create(**obj_in.dict())
16+
return {"detail": "Message sent successfully!" }
1817

1918
contact = ContactCRUD(Contact)

contact/endpoints.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
router = APIRouter()
99

10-
@router.post("/", status_code=201, response_model=ContactOut)
11-
async def create_contact(request: ContactCreate) -> Any:
10+
@router.post("/", status_code=201)
11+
def create_contact(request: ContactCreate) -> Any:
1212
"""
1313
End point for contact creation.
1414
This should always be placed above the single GET endpoint.
1515
"""
16-
return await contact.create(obj_in=request)
16+
return contact.create(obj_in=request)
1717

0 commit comments

Comments
 (0)