1 ##############################################################################
2 # Copyright (c) 2016 Max Breitenfeldt and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
11 from django.contrib.auth.models import User
12 from django.db import models
15 def upload_to(object, filename):
16 return object.user.username + '/' + filename
18 class UserProfile(models.Model):
19 user = models.OneToOneField(User, on_delete=models.CASCADE)
20 timezone = models.CharField(max_length=100, blank=False, default='UTC')
21 ssh_public_key = models.FileField(upload_to=upload_to, null=True, blank=True)
22 pgp_public_key = models.FileField(upload_to=upload_to, null=True, blank=True)
23 email_addr = models.CharField(max_length=300, blank=False, default='email@mail.com')
24 company = models.CharField(max_length=200, blank=False)
26 oauth_token = models.CharField(max_length=1024, blank=False)
27 oauth_secret = models.CharField(max_length=1024, blank=False)
29 jira_url = models.CharField(max_length=100, default='')
30 full_name = models.CharField(max_length=100, default='')
33 db_table = 'user_profile'
36 return self.user.username