Skip to content
Snippets Groups Projects
Commit cb71edf4 authored by Calum Mackervoy's avatar Calum Mackervoy
Browse files

bugfix missing username from backlinked user

parent 7753f719
No related branches found
No related tags found
No related merge requests found
import json
import uuid
from urllib.parse import urlparse
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth import get_user_model
from django.db import models
from django.db.models import BinaryField, DateField
......@@ -150,8 +152,10 @@ class Model(models.Model):
try:
print('get_or_create ' + str(model) + ' backlink ' + str(urlid))
return model.objects.get(urlid=urlid)
except model.DoesNotExist:
except ObjectDoesNotExist:
print('creating..')
if model is get_user_model():
field_tuples['username'] = uuid.uuid4()
return model.objects.create(urlid=urlid, allow_create_backlink=False, **field_tuples)
@classonlymethod
......
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