aboutsummaryrefslogtreecommitdiff
path: root/apps/accounts/models.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2019-01-09 13:29:17 -0600
committerluxagraf <sng@luxagraf.net>2019-01-09 13:29:17 -0600
commitbe0bb4e123240ac3ce02431b974c82f8f05d843b (patch)
treee2da7ac44be955ad5cbf32c0a35dc507ba63e844 /apps/accounts/models.py
parentd5f430d3e1e2b274d8d8f744251e8b6b4b72ebd9 (diff)
latest changes
Diffstat (limited to 'apps/accounts/models.py')
-rw-r--r--apps/accounts/models.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/apps/accounts/models.py b/apps/accounts/models.py
index 1b62ffd..feb20bf 100644
--- a/apps/accounts/models.py
+++ b/apps/accounts/models.py
@@ -1,4 +1,5 @@
from django.db import models
+from django.urls import reverse
from django.contrib.auth.models import AbstractUser
from django.utils.functional import cached_property
@@ -15,15 +16,18 @@ class User(AbstractUser):
class UserProfile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile')
photo = models.ImageField(upload_to='profile', null=True, blank=True)
- website = models.CharField(max_length=300, null=True, blank=True, default='')
- location = models.CharField(max_length=300, null=True, blank=True, default='')
- bio = models.TextField(null=True, blank=True, default='')
+ website = models.CharField(max_length=300, blank=True, default='')
+ location = models.CharField(max_length=300, blank=True, default='')
+ bio = models.CharField(max_length=350, blank=True, default='')
+ #default_note_folder = models.ForeignKey('notes.Notebook', null=True, on_delete=models.SET_NULL)
#default_note_public = models.BooleanField(default=False)
- #default_note_folder = models.ForeignKey('notes.Folder', null=True, on_delete=models.SET_NULL)
def __str__(self):
return self.user.username
+ def get_absolute_url(self):
+ return reverse("accounts:settings")
+
@cached_property
def get_notebook_list(self):
return Notebook.objects.filter(owner=self.user).select_related().annotate(note_count=models.Count('note'))[:8]