Skip to content

Commit

Permalink
Require spec id for form fields
Browse files Browse the repository at this point in the history
Closes #163
  • Loading branch information
matthewwithanm committed Dec 1, 2012
1 parent 4ead0b3 commit 54baa44
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions imagekit/forms/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
class ProcessedImageField(ImageField, SpecHost):

def __init__(self, processors=None, format=None, options=None,
autoconvert=True, spec=None, spec_id=None, *args, **kwargs):
autoconvert=True, spec_id=None, spec=None, *args, **kwargs):

if spec_id is None:
spec_id = '??????' # FIXME: Wher should we get this?
# Unlike model fields, form fields are never told their field name.
# (Model fields are done so via `contribute_to_class()`.) Therefore
# we can't really generate a good spec id automatically.
raise TypeError('You must provide a spec_id')

SpecHost.__init__(self, processors=processors, format=format,
options=options, autoconvert=autoconvert, spec=spec,
Expand Down

0 comments on commit 54baa44

Please sign in to comment.