summaryrefslogtreecommitdiffstats
path: root/tools/pharos-dashboard/account
diff options
context:
space:
mode:
Diffstat (limited to 'tools/pharos-dashboard/account')
-rw-r--r--tools/pharos-dashboard/account/forms.py2
-rw-r--r--tools/pharos-dashboard/account/migrations/0001_initial.py33
-rw-r--r--tools/pharos-dashboard/account/migrations/0002_auto_20160816_1511.py27
-rw-r--r--tools/pharos-dashboard/account/migrations/0002_userprofile_timezone.py20
-rw-r--r--tools/pharos-dashboard/account/migrations/0003_auto_20160819_1024.py25
-rw-r--r--tools/pharos-dashboard/account/migrations/0003_userprofile_registration_complete.py20
-rw-r--r--tools/pharos-dashboard/account/migrations/0004_auto_20160812_1805.py26
-rw-r--r--tools/pharos-dashboard/account/migrations/0004_auto_20160819_1055.py20
-rw-r--r--tools/pharos-dashboard/account/migrations/0005_remove_userprofile_registration_complete.py19
-rw-r--r--tools/pharos-dashboard/account/migrations/0006_auto_20160813_1443.py26
-rw-r--r--tools/pharos-dashboard/account/migrations/0007_auto_20160814_1056.py20
-rw-r--r--tools/pharos-dashboard/account/models.py6
12 files changed, 4 insertions, 240 deletions
diff --git a/tools/pharos-dashboard/account/forms.py b/tools/pharos-dashboard/account/forms.py
index 14f11cda..92c55d85 100644
--- a/tools/pharos-dashboard/account/forms.py
+++ b/tools/pharos-dashboard/account/forms.py
@@ -9,6 +9,4 @@ class AccountSettingsForm(forms.ModelForm):
model = UserProfile
fields = ['company', 'ssh_public_key', 'pgp_public_key', 'timezone']
- ssh_public_key = forms.CharField(max_length=2048, widget=forms.Textarea)
- pgp_public_key = forms.CharField(max_length=2048, widget=forms.Textarea)
timezone = forms.ChoiceField(choices=[(x, x) for x in pytz.common_timezones], initial='UTC')
diff --git a/tools/pharos-dashboard/account/migrations/0001_initial.py b/tools/pharos-dashboard/account/migrations/0001_initial.py
deleted file mode 100644
index 4ff9510a..00000000
--- a/tools/pharos-dashboard/account/migrations/0001_initial.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10 on 2016-08-15 12:19
-from __future__ import unicode_literals
-
-from django.conf import settings
-from django.db import migrations, models
-import django.db.models.deletion
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- migrations.swappable_dependency(settings.AUTH_USER_MODEL),
- ]
-
- operations = [
- migrations.CreateModel(
- name='UserProfile',
- fields=[
- ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('timezone', models.CharField(default='UTC', max_length=100)),
- ('sshkey', models.CharField(max_length=2048)),
- ('pgpkey', models.CharField(max_length=2048)),
- ('company', models.CharField(max_length=200)),
- ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
- ],
- options={
- 'db_table': 'user_profile',
- },
- ),
- ]
diff --git a/tools/pharos-dashboard/account/migrations/0002_auto_20160816_1511.py b/tools/pharos-dashboard/account/migrations/0002_auto_20160816_1511.py
deleted file mode 100644
index 3fcd989a..00000000
--- a/tools/pharos-dashboard/account/migrations/0002_auto_20160816_1511.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10 on 2016-08-16 15:11
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('account', '0001_initial'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='userprofile',
- name='oauth_secret',
- field=models.CharField(default='', max_length=1024),
- preserve_default=False,
- ),
- migrations.AddField(
- model_name='userprofile',
- name='oauth_token',
- field=models.CharField(default='', max_length=1024),
- preserve_default=False,
- ),
- ]
diff --git a/tools/pharos-dashboard/account/migrations/0002_userprofile_timezone.py b/tools/pharos-dashboard/account/migrations/0002_userprofile_timezone.py
deleted file mode 100644
index ea67598a..00000000
--- a/tools/pharos-dashboard/account/migrations/0002_userprofile_timezone.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10 on 2016-08-12 13:17
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('account', '0001_initial'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='userprofile',
- name='timezone',
- field=models.CharField(default='UTC', max_length=100),
- ),
- ]
diff --git a/tools/pharos-dashboard/account/migrations/0003_auto_20160819_1024.py b/tools/pharos-dashboard/account/migrations/0003_auto_20160819_1024.py
deleted file mode 100644
index b648844e..00000000
--- a/tools/pharos-dashboard/account/migrations/0003_auto_20160819_1024.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10 on 2016-08-19 10:24
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('account', '0002_auto_20160816_1511'),
- ]
-
- operations = [
- migrations.RenameField(
- model_name='userprofile',
- old_name='pgpkey',
- new_name='pgp_pupblic_key',
- ),
- migrations.RenameField(
- model_name='userprofile',
- old_name='sshkey',
- new_name='ssh_public_key',
- ),
- ]
diff --git a/tools/pharos-dashboard/account/migrations/0003_userprofile_registration_complete.py b/tools/pharos-dashboard/account/migrations/0003_userprofile_registration_complete.py
deleted file mode 100644
index d6114434..00000000
--- a/tools/pharos-dashboard/account/migrations/0003_userprofile_registration_complete.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10 on 2016-08-12 17:09
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('account', '0002_userprofile_timezone'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='userprofile',
- name='registration_complete',
- field=models.BooleanField(default=False),
- ),
- ]
diff --git a/tools/pharos-dashboard/account/migrations/0004_auto_20160812_1805.py b/tools/pharos-dashboard/account/migrations/0004_auto_20160812_1805.py
deleted file mode 100644
index cb228557..00000000
--- a/tools/pharos-dashboard/account/migrations/0004_auto_20160812_1805.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10 on 2016-08-12 18:05
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('account', '0003_userprofile_registration_complete'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='userprofile',
- name='gpgkey',
- field=models.CharField(default='a', max_length=2048),
- preserve_default=False,
- ),
- migrations.AlterField(
- model_name='userprofile',
- name='sshkey',
- field=models.CharField(max_length=2048),
- ),
- ]
diff --git a/tools/pharos-dashboard/account/migrations/0004_auto_20160819_1055.py b/tools/pharos-dashboard/account/migrations/0004_auto_20160819_1055.py
deleted file mode 100644
index 51af0aa9..00000000
--- a/tools/pharos-dashboard/account/migrations/0004_auto_20160819_1055.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10 on 2016-08-19 10:55
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('account', '0003_auto_20160819_1024'),
- ]
-
- operations = [
- migrations.RenameField(
- model_name='userprofile',
- old_name='pgp_pupblic_key',
- new_name='pgp_public_key',
- ),
- ]
diff --git a/tools/pharos-dashboard/account/migrations/0005_remove_userprofile_registration_complete.py b/tools/pharos-dashboard/account/migrations/0005_remove_userprofile_registration_complete.py
deleted file mode 100644
index fa4bf729..00000000
--- a/tools/pharos-dashboard/account/migrations/0005_remove_userprofile_registration_complete.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10 on 2016-08-13 10:49
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('account', '0004_auto_20160812_1805'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='userprofile',
- name='registration_complete',
- ),
- ]
diff --git a/tools/pharos-dashboard/account/migrations/0006_auto_20160813_1443.py b/tools/pharos-dashboard/account/migrations/0006_auto_20160813_1443.py
deleted file mode 100644
index 7d9cd58e..00000000
--- a/tools/pharos-dashboard/account/migrations/0006_auto_20160813_1443.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10 on 2016-08-13 14:43
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('account', '0005_remove_userprofile_registration_complete'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='userresource',
- name='resource',
- ),
- migrations.RemoveField(
- model_name='userresource',
- name='user',
- ),
- migrations.DeleteModel(
- name='UserResource',
- ),
- ]
diff --git a/tools/pharos-dashboard/account/migrations/0007_auto_20160814_1056.py b/tools/pharos-dashboard/account/migrations/0007_auto_20160814_1056.py
deleted file mode 100644
index 2d1bbaeb..00000000
--- a/tools/pharos-dashboard/account/migrations/0007_auto_20160814_1056.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10 on 2016-08-14 10:56
-from __future__ import unicode_literals
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('account', '0006_auto_20160813_1443'),
- ]
-
- operations = [
- migrations.RenameField(
- model_name='userprofile',
- old_name='gpgkey',
- new_name='pgpkey',
- ),
- ]
diff --git a/tools/pharos-dashboard/account/models.py b/tools/pharos-dashboard/account/models.py
index fbabf6c4..fb2c8ddd 100644
--- a/tools/pharos-dashboard/account/models.py
+++ b/tools/pharos-dashboard/account/models.py
@@ -4,12 +4,14 @@ from django.contrib.auth.models import User
from dashboard.models import Resource
+def upload_to(object, filename):
+ return object.user.username + '/' + filename
class UserProfile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
timezone = models.CharField(max_length=100, blank=False, default='UTC')
- ssh_public_key = models.CharField(max_length=2048, blank=False)
- pgp_public_key = models.CharField(max_length=2048, blank=False)
+ ssh_public_key = models.FileField(upload_to=upload_to, null=True, blank=True)
+ pgp_public_key = models.FileField(upload_to=upload_to, null=True, blank=True)
company = models.CharField(max_length=200, blank=False)
oauth_token = models.CharField(max_length=1024, blank=False)
oauth_secret = models.CharField(max_length=1024, blank=False)