macropin / django-registration

Django-registration (redux) provides user registration functionality for Django websites.
http://django-registration-redux.readthedocs.org
Other
974 stars 350 forks source link

TypeError: __init__() missing 1 required positional argument: 'on_delete' with Django 2 #336

Closed zkan closed 5 years ago

zkan commented 6 years ago

Hi there, I'm using Django==2.0.7 and got the error below:

File "/usr/local/lib/python3.7/site-packages/registration/models.py", line 171, in <module>
    class RegistrationProfile(models.Model):
File "/usr/local/lib/python3.7/site-packages/registration/models.py", line 189, in RegistrationProfile
    user = models.OneToOneField(UserModelString(), verbose_name=_('user'))
TypeError: __init__() missing 1 required positional argument: 'on_delete'

I'm guessing that on_delete is required in Django 2+. The doc says it works with Django 2.0. Is there a way or a workaround to fix this?

Any suggestion is very welcome. Thank you!

joshblum commented 6 years ago

hey @zkan i think you're on an older version of the library. in the latest library release 2.4 we have the field set: https://github.com/macropin/django-registration/blob/v2.4/registration/models.py#L303 can you confirm what version of the library you're running?

zkan commented 5 years ago

@joshblum Oh, I was using the older version. It's working now. Thank you!