Revision history [back]
Error when posting - Can't find personal group (into existing site Django 1.8
Hello!
I'm trying to add askbot into an existing site running Django 1.8. I've just got things up and running, but ran into an error when trying out my first test post. It bombs on the last line here:
def user_get_personal_group(self):
group_name = format_personal_group_name(self)
return Group.objects.get(name=group_name) # bombs here with Group.DoesNotExist error
Looking around, it looks like the function 'add_user_to_personal_group' wasn't called because the user model was never saved/existed before I integrated askbot. I'm tempted to change the code to:
def user_get_personal_group(self):
group_name = format_personal_group_name(self)
try:
return Group.objects.get(name=group_name)
except Group.DoesNotExist:
add_user_to_personal_group( None, self, True ) # Add the group if not here.
return Group.objects.get(name=group_name)
But don't know if that is the right way to go about this. Would there be a better way for me to do?
Thanks!
Error when posting - Can't find personal group (into existing site Django 1.8
Hello!
I'm trying to add askbot into an existing site running Django 1.8. I've just got things up and running, but ran into an error when trying out my first test post. It bombs on the last line here:
def user_get_personal_group(self):
group_name = format_personal_group_name(self)
return Group.objects.get(name=group_name) # bombs here with Group.DoesNotExist error
Looking around, it looks like the function 'add_user_to_personal_group' wasn't called because the user model was never saved/existed before I integrated askbot. I'm tempted to change the code to:
def user_get_personal_group(self):
group_name = format_personal_group_name(self)
try:
return Group.objects.get(name=group_name)
except Group.DoesNotExist:
add_user_to_personal_group( None, self, True ) # Add the group if not here.
return Group.objects.get(name=group_name)
But don't know if that is the right way to go about this. Would there be a better way for me to do?
Thanks!