Move MinecraftProfile from the profiles app into the minecraft app, and stop using the auth profiles feature.

Might go back to auth profiles if a suitable use can be found.
This commit is contained in:
Trever Fischer
2012-03-04 23:18:00 -05:00
parent 060c964e95
commit e0957c2dab
13 changed files with 123 additions and 34 deletions

View File

@@ -1,10 +1,18 @@
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
import pyspy
from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist
from profiles.models import MinecraftProfile
import socket
class MinecraftProfile(models.Model):
user = models.OneToOneField(User)
mc_username = models.CharField(max_length=30, verbose_name="Minecraft.net Username", unique=True)
def __unicode__(self):
return self.mc_username
class Server(models.Model):
hostname = models.CharField(max_length=100)
port = models.IntegerField(default=25565)
@@ -43,3 +51,9 @@ class MOTD(models.Model):
def __unicode__(self):
return self.text
def create_profile(sender, instance, created, **kwargs):
if created:
MinecraftProfile.objects.create(user=instance)
post_save.connect(create_profile, sender=User)