diff --git a/accounts/models.py b/accounts/models.py index 2e5bfe6..53f4810 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -36,7 +36,7 @@ class UserProfile(models.Model): ) # User - user = models.OneToOneField(User, on_delete=models.DO_NOTHING) + user = models.OneToOneField(User, on_delete=models.CASCADE) is_pro = models.BooleanField(default=False) teams_beta_seen = models.BooleanField(default=False) teams_beta_applied = models.BooleanField(default=False) diff --git a/settings.py b/settings.py index 9ef4710..d1f68f8 100644 --- a/settings.py +++ b/settings.py @@ -16,7 +16,7 @@ BASE_PATH = os.path.dirname(__file__) CSRF_COOKIE_SECURE = True if "USE_SSL" in os.environ else False CORS_ORIGIN_ALLOW_ALL = True DEBUG = True if "DEBUG" in os.environ else False -DEFAULT_FROM_EMAIL = os.environ.get("POSTMARK_EMAIL", "support@siftie.com") +DEFAULT_FROM_EMAIL = os.environ.get("POSTMARK_EMAIL", "team@siftie.com") EMAIL_BACKEND = "postmark.django_backend.EmailBackend" # HAYSTACK_CONNECTIONS = { # "default": { @@ -52,7 +52,7 @@ SECRET_KEY = os.environ.get("SECRET_KEY", "changeme") SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") SECURE_SSL_REDIRECT = True if "USE_SSL" in os.environ else False SEND_BROKEN_LINK_EMAILS = False -SERVER_EMAIL = os.environ.get("POSTMARK_EMAIL", "support@siftie.com") +SERVER_EMAIL = os.environ.get("POSTMARK_EMAIL", "team@siftie.com") SESSION_COOKIE_AGE = 15801100 SESSION_COOKIE_SECURE = True if "USE_SSL" in os.environ else False SITE_ID = 1 @@ -65,7 +65,7 @@ STATICFILES_STORAGE = "whitenoise.django.GzipManifestStaticFilesStorage" STATIC_ROOT = os.path.join(BASE_PATH, "static") STATIC_URL = "/static/" TASTYPIE_CANNED_ERROR = """There was an error with your request. The site - developers have a record of this error, please email support@siftie.com and + developers have a record of this error, please email team@siftie.com and we'll help you out.""" TEMPLATES = [ diff --git a/snipts/models.py b/snipts/models.py index 0e88610..074b5c8 100644 --- a/snipts/models.py +++ b/snipts/models.py @@ -22,13 +22,13 @@ from teams.models import Team class Snipt(models.Model): """An individual Snipt.""" - user = models.ForeignKey(User, blank=True, null=True, on_delete=models.DO_NOTHING) + user = models.ForeignKey(User, blank=True, null=True, on_delete=models.CASCADE) last_user_saved = models.ForeignKey( User, blank=True, null=True, related_name="last_user_saved", - on_delete=models.DO_NOTHING, + on_delete=models.CASCADE, ) title = models.CharField(max_length=255, blank=True, null=True, default="Untitled") @@ -313,8 +313,8 @@ class Snipt(models.Model): class SniptLogEntry(models.Model): """An individual log entry for a snippet changeset.""" - user = models.ForeignKey(User, on_delete=models.DO_NOTHING) - snipt = models.ForeignKey(Snipt, on_delete=models.DO_NOTHING) + user = models.ForeignKey(User, on_delete=models.CASCADE) + snipt = models.ForeignKey(Snipt, on_delete=models.CASCADE) code = models.TextField() diff = models.TextField() @@ -330,8 +330,8 @@ class SniptLogEntry(models.Model): class SniptSecureView(models.Model): """A single view to a secure snippet.""" - user = models.ForeignKey(User, on_delete=models.DO_NOTHING) - snipt = models.ForeignKey(Snipt, on_delete=models.DO_NOTHING) + user = models.ForeignKey(User, on_delete=models.CASCADE) + snipt = models.ForeignKey(Snipt, on_delete=models.CASCADE) created = models.DateTimeField(auto_now_add=True, editable=False) modified = models.DateTimeField(auto_now=True, editable=False) @@ -342,8 +342,8 @@ class SniptSecureView(models.Model): class Favorite(models.Model): - snipt = models.ForeignKey(Snipt, on_delete=models.DO_NOTHING) - user = models.ForeignKey(User, on_delete=models.DO_NOTHING) + snipt = models.ForeignKey(Snipt, on_delete=models.CASCADE) + user = models.ForeignKey(User, on_delete=models.CASCADE) created = models.DateTimeField(auto_now_add=True, editable=False) modified = models.DateTimeField(auto_now=True, editable=False) diff --git a/snipts/templates/snipts/snipt-list.html b/snipts/templates/snipts/snipt-list.html index 4d73a65..4526f34 100644 --- a/snipts/templates/snipts/snipt-list.html +++ b/snipts/templates/snipts/snipt-list.html @@ -206,6 +206,11 @@ / API {% endif %} + {% if snipt.user != request.user %} +
+ Create a Team account and allow your team members to create and + edit private and public code snippets. Search through all your team's snippets, and + view detailed diffs of changes to each snippet. +
+
+ Individuals can post public and private
snippets, making them perfect
+ for storing and organizing code you never want to forget.
+
+ A full blog in seconds: mark a snipt as "Blog Post", and it'll
+ appear on {your-username}.snipt.net
. Markdown support built-in. Your domain, or ours.
+