-
-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix-blog-editor' of https://github.com/harsh3dev/BLT in…
…to fix-blog-editor
- Loading branch information
Showing
92 changed files
with
11,615 additions
and
1,661 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,7 @@ DATABASE_URL=postgres://user:password@localhost:5432/dbname | |
|
||
#Sentry DSN | ||
SENTRY_DSN=https://[email protected]/0 | ||
|
||
|
||
SLACK_CLIENT_ID= | ||
SLACK_CLIENT_SECRET= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ requirements.txt | |
*.code-workspace | ||
*.log | ||
*.exe | ||
.vs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 5.1.3 on 2024-11-24 02:43 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("blog", "0003_post_image"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="post", | ||
name="slug", | ||
field=models.SlugField(blank=True, max_length=255, unique=True), | ||
), | ||
migrations.AlterField( | ||
model_name="post", | ||
name="title", | ||
field=models.CharField(max_length=255), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 5.1.3 on 2024-11-24 18:26 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("blog", "0004_alter_post_slug_alter_post_title"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="post", | ||
name="image", | ||
field=models.ImageField(upload_to="blog_posts"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,37 @@ | ||
from django.contrib.auth.models import User | ||
from django.core.exceptions import ValidationError | ||
from django.db import models | ||
from django.db.models.signals import post_save | ||
from django.dispatch import receiver | ||
from django.urls import reverse | ||
|
||
|
||
class Post(models.Model): | ||
title = models.CharField(max_length=200) | ||
slug = models.SlugField(unique=True, blank=True) | ||
title = models.CharField(max_length=255) | ||
slug = models.SlugField(unique=True, blank=True, max_length=255) | ||
author = models.ForeignKey(User, on_delete=models.CASCADE) | ||
content = models.TextField() | ||
created_at = models.DateTimeField(auto_now_add=True) | ||
updated_at = models.DateTimeField(auto_now=True) | ||
image = models.ImageField() | ||
image = models.ImageField(upload_to="blog_posts") | ||
|
||
def __str__(self): | ||
return self.title | ||
|
||
def get_absolute_url(self): | ||
return reverse("post_detail", kwargs={"slug": self.slug}) | ||
|
||
|
||
@receiver(post_save, sender=Post) | ||
def verify_file_upload(sender, instance, **kwargs): | ||
from django.core.files.storage import default_storage | ||
|
||
print("Verifying file upload...") | ||
print(f"Default storage backend: {default_storage.__class__.__name__}") | ||
if instance.image: | ||
print(f"Checking if image '{instance.image.name}' exists in the storage backend...") | ||
if not default_storage.exists(instance.image.name): | ||
print(f"Image '{instance.image.name}' was not uploaded to the storage backend.") | ||
raise ValidationError( | ||
f"Image '{instance.image.name}' was not uploaded to the storage backend." | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
{% extends "company/company_dashboard_base.html" %} | ||
{% block title %} | ||
Add Slack Integration | ||
{% endblock title %} | ||
{% block body %} | ||
<div class="bg-[#F3F5F7] flex flex-col items-center"> | ||
<div class="w-full mt-5"> | ||
<p class="text-red-700 font-satoshi font-bold text-[35px] px-8">Add Slack Integration</p> | ||
</div> | ||
<form method='post' | ||
action="#" | ||
class="w-[96%] bg-white rounded-2xl p-10 my-10 shadow-md"> | ||
{% csrf_token %} | ||
<div class="pb-12"> | ||
<h2 class="text-base font-semibold leading-7 text-gray-900">Configure Slack Bot:</h2> | ||
<div class="mt-10 grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6"> | ||
<div class="sm:col-span-3"> | ||
<label for="bot_token" | ||
class="block text-sm font-medium leading-6 text-gray-900">Bot Token</label> | ||
<div class="mt-2"> | ||
<input type="text" | ||
name="bot_token" | ||
id="bot_token" | ||
autocomplete="bot_token" | ||
value="{{ slack_integration.bot_access_token }}" | ||
disabled | ||
class="block w-full rounded-md border-0 py-1.5 pl-3 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-red-600 sm:text-sm sm:leading-6" /> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="mt-10 grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6"> | ||
<div class="sm:col-span-3"> | ||
<label class="block text-sm font-medium leading-6 text-gray-900" | ||
for="target_channel">Select Channel to send messages to</label> | ||
<div class="mt-2 space-y-4"> | ||
<select id="target_channel" | ||
name="target_channel" | ||
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"> | ||
{% for channel_name in channels %} | ||
<option value="{{ channel_name }}" | ||
{% if slack_integration.default_channel_name == channel_name %}selected="selected"{% endif %}> | ||
{{ channel_name }} | ||
</option> | ||
{% endfor %} | ||
</select> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class=" grid grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6"> | ||
<div class="sm:col-span-3"> | ||
<label class="block text-sm font-medium leading-6 text-gray-900">Select Services</label> | ||
<div class="items-center flex"> | ||
<input type="checkbox" | ||
id="daily_sizzle_timelogs_status" | ||
name="daily_sizzle_timelogs_status" | ||
class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded" | ||
{% if slack_integration.daily_updates == True %}checked{% endif %}> | ||
<label for="daily_sizzle_timelogs_status" | ||
class="ml-3 block text-sm font-medium text-gray-900"> | ||
Daily Sizzle Timelogs Status | ||
</label> | ||
</div> | ||
</div> | ||
<div class="sm:col-span-3 flex"> | ||
<select id="daily_sizzle_timelogs_hour" | ||
name="daily_sizzle_timelogs_hour" | ||
class="mt-2 block pl-3 pr-10 py-2 text-base focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md"> | ||
<option value="" disabled>Select Hour in UTC</option> | ||
<!-- Loop to generate options from 0 to 23 --> | ||
{% for hour in hours %} | ||
<option value="{{ hour }}" | ||
{% if slack_integration.daily_update_time == hour %}selected="selected"{% endif %}> | ||
{{ hour }} | ||
</option> | ||
{% endfor %} | ||
</select> | ||
</div> | ||
</div> | ||
<div class="mt-6 flex items-center justify-end gap-x-6"> | ||
<button type="submit" | ||
class="rounded-md bg-red-600 px-11 py-3 text-md font-semibold text-white shadow-sm hover:bg-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600"> | ||
Save | ||
</button> | ||
</div> | ||
</div> | ||
</form> | ||
{% endblock body %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.