Hope that helps If you are planning on using django.contrib.auth, you can write your own custom user model in Django 1.5. The example listed in the docs would work for your use-case. You don't need to extend AbstractBaseUser, but if you do, it expects a USERNAME_FIELD value. Alternatively you can use any kind of model you want, but without a USERNAME_FIELD convenient methods like login() and logout() and authenticate() may break.
How to add fields to Django User model and show it on registration form with django-registration?
I wish did fix the issue. In newer versions of Django, making your own custom User model is quite painless. See this answer for details: https://stackoverflow.com/a/16125609/236195 You might run into problems if you are using some older third-party apps which have model relationships hardcoded to auth.models.User. Most of third-party apps which have ongoing development have probably switched already or will do so soon.
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.utils.translation import ugettext_lazy as _
age = models.PositiveIntegerField(_("age"), null=True) # this field is added to default User model
With these it helps My approach would probably be to create a new Model, with a foreign key referencing the User model. It would look something like this (in your models.py):
username = models.ForeignKey(User)
hardware_key = models.CharField(max_length=32, primary_key=True)
from models import Device, User
device = Device.objects.get(hardware_key=<key>)
# deal with case where user tries to register non-existent key
device.username = <user>
# deal with case where key is already registered to another user
How can user registration form for base django user model create ForeignKey user