Skip to content
Snippets Groups Projects
Commit 485d64fe authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Error if the user doesnt provide a json_field

parent d95abeaa
No related branches found
No related tags found
No related merge requests found
...@@ -420,6 +420,11 @@ class JSONOrderable(models.QuerySet): ...@@ -420,6 +420,11 @@ class JSONOrderable(models.QuerySet):
json_field = '' json_field = ''
def order_by(self, *field_names): def order_by(self, *field_names):
if not self.json_field:
raise ValueError(
'json_field cannot be blank, please provide a field on which to perform the ordering'
)
def build_json_order_by(field): def build_json_order_by(field):
if field.replace('-', '') not in REQUIRED_BLOCK_NAMES: if field.replace('-', '') not in REQUIRED_BLOCK_NAMES:
return field return field
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment