Skip to content
This repository has been archived by the owner on Mar 21, 2018. It is now read-only.

Commit

Permalink
continued working on auth update
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkohl committed Jun 24, 2017
1 parent 2397931 commit f5dfd52
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion dictionary/api/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from rest_framework.authtoken.models import Token
from django.conf import settings


PARTS_OF_SPEECH = [
Expand Down Expand Up @@ -372,4 +376,10 @@ def to_xref(self):
"artist": self.artist.to_xref(),
"place": self.place.to_xref(),
"rhymes": [r.to_xref() for r in self.rhymes.all()]
}
}


@receiver(post_save, sender=settings.AUTH_USER_MODEL)
def create_auth_token(sender, instance=None, created=False, **kwargs):
if created:
Token.objects.create(user=instance)

0 comments on commit f5dfd52

Please sign in to comment.