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.db import models
13 from django.contrib.auth.models import User
15 from dashboard.models import Resource
17 def upload_to(object, filename):
18 return object.user.username + '/' + filename
20 class UserProfile(models.Model):
21 user = models.OneToOneField(User, on_delete=models.CASCADE)
22 timezone = models.CharField(max_length=100, blank=False, default='UTC')
23 ssh_public_key = models.FileField(upload_to=upload_to, null=True, blank=True)
24 pgp_public_key = models.FileField(upload_to=upload_to, null=True, blank=True)
25 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)
30 db_table = 'user_profile'