Closed TCAllen07 closed 9 years ago
The issue is just another incompatibility of this project with Django 1.7 ( I chronicled the initial installation issues in a StackOverflow post ). The user.get_profile()
method is deprecated in 1.7. Two minor edits resolve this problem. First, in profiles.models.py replace the Profile-User relationship with a OneToOneField
including a back-reference:
class Profile(models.Model):
# user = models.ForeignKey(User)
user = models.OneToOneField(User, related_name="profile")
Then in profiles.views.py, update the get_object()
call like so:
class ProfileEditView(LoginRequiredMixin, UpdateView):
# ...
def get_object(self):
# return self.request.user.get_profile()
return self.request.user.profile
I would make a pull request with the update, but I get the impression this particular repo isn't really being updated for Django 1.7. Rather it looks like pinax-project-account is replacing this 1.7 and onward.
I'm working with an essentially "raw" copy of the pinax-project-teams project, and having created a single user (a superuser account as well) named "trevor" and logged in, trying to edit the user profile errors out.
Starting from /u// and clicking the "Edit Profile" button leads to /profile/edit/, which throws: //profiles/views.py. I've included the stacktrace below, and can provide any of the info Django's debug capability provides (Request info & local vars, etc), just let me know.
AttributeError: 'User' object has no attribute 'get_profile'
, which is called fromI thought I'd try subclassing the
django.contrib.auth.models.User
object myself under project_name/project_name/profiles/models.py, but I'm rather new to Django and figure I'm likely to make it worse! ;-) But I'll probably play with it anyway, and update here if I figure anything out.