update libraries
This commit is contained in:
parent
55af847443
commit
d19d81fb1e
|
@ -382,7 +382,7 @@ EDITOR_INCLUDE_JAVASCRIPT = False
|
||||||
MARTOR_ENABLE_CONFIGS = {
|
MARTOR_ENABLE_CONFIGS = {
|
||||||
'imgur': 'true', # to enable/disable imgur uploader/custom uploader.
|
'imgur': 'true', # to enable/disable imgur uploader/custom uploader.
|
||||||
'mention': 'true', # to enable/disable mention
|
'mention': 'true', # to enable/disable mention
|
||||||
'jquery': 'false', # to include/revoke jquery (require for admin default django)
|
'jquery': 'true', # to include/revoke jquery (require for admin default django)
|
||||||
}
|
}
|
||||||
MARTOR_UPLOAD_PATH = 'images/uploads/{}'.format(time.strftime("%Y/%m/%d/"))
|
MARTOR_UPLOAD_PATH = 'images/uploads/{}'.format(time.strftime("%Y/%m/%d/"))
|
||||||
MARTOR_UPLOAD_URL = '/api/uploader/' # change to local uploader
|
MARTOR_UPLOAD_URL = '/api/uploader/' # change to local uploader
|
||||||
|
|
|
@ -6,27 +6,50 @@ from django.db import migrations, models
|
||||||
import django.utils.timezone
|
import django.utils.timezone
|
||||||
import stdimage.models
|
import stdimage.models
|
||||||
import stdimage.utils
|
import stdimage.utils
|
||||||
|
import dynamic_filenames
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = []
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='BannerImages',
|
name="BannerImages",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
(
|
||||||
('url', models.URLField()),
|
"id",
|
||||||
('title', models.CharField(max_length=255)),
|
models.AutoField(
|
||||||
('displayed', models.BooleanField(default=True)),
|
auto_created=True,
|
||||||
('original_image', models.URLField(blank=True, max_length=255, null=True)),
|
primary_key=True,
|
||||||
('scaled_image', stdimage.models.StdImageField(blank=True, null=True, upload_to=stdimage.utils.UploadToAutoSlugClassNameDir('title'))),
|
serialize=False,
|
||||||
('caption', models.TextField()),
|
verbose_name="ID",
|
||||||
('date', models.DateTimeField(default=django.utils.timezone.now)),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
("url", models.URLField()),
|
||||||
|
("title", models.CharField(max_length=255)),
|
||||||
|
("displayed", models.BooleanField(default=True)),
|
||||||
|
(
|
||||||
|
"original_image",
|
||||||
|
models.URLField(blank=True, max_length=255, null=True),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"scaled_image",
|
||||||
|
stdimage.models.StdImageField(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
upload_to=dynamic_filenames.FilePattern(
|
||||||
|
filename_pattern="{model_name}/{instance.title:slug}{ext}"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("caption", models.TextField()),
|
||||||
|
(
|
||||||
|
"date",
|
||||||
|
models.DateTimeField(default=django.utils.timezone.now),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,18 +6,24 @@ from django.db import migrations
|
||||||
import stdimage.models
|
import stdimage.models
|
||||||
import stdimage.utils
|
import stdimage.utils
|
||||||
import stdimage.validators
|
import stdimage.validators
|
||||||
|
import dynamic_filenames
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [("base", "0001_initial")]
|
||||||
('base', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='bannerimages',
|
model_name="bannerimages",
|
||||||
name='scaled_image',
|
name="scaled_image",
|
||||||
field=stdimage.models.StdImageField(blank=True, null=True, upload_to=stdimage.utils.UploadToAutoSlugClassNameDir('title'), validators=[stdimage.validators.MinSizeValidator(800, 600)]),
|
field=stdimage.models.StdImageField(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
upload_to=dynamic_filenames.FilePattern(
|
||||||
|
filename_pattern="{model_name}/{instance.title:slug}{ext}"
|
||||||
),
|
),
|
||||||
|
validators=[stdimage.validators.MinSizeValidator(800, 600)],
|
||||||
|
),
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,18 +6,24 @@ from django.db import migrations
|
||||||
import stdimage.models
|
import stdimage.models
|
||||||
import stdimage.utils
|
import stdimage.utils
|
||||||
import stdimage.validators
|
import stdimage.validators
|
||||||
|
import dynamic_filenames
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [("base", "0002_auto_20170214_1911")]
|
||||||
('base', '0002_auto_20170214_1911'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='bannerimage',
|
model_name="bannerimage",
|
||||||
name='scaled_image',
|
name="scaled_image",
|
||||||
field=stdimage.models.StdImageField(blank=True, null=True, upload_to=stdimage.utils.UploadToAutoSlugClassNameDir('title'), validators=[stdimage.validators.MinSizeValidator(1200, 300)]),
|
field=stdimage.models.StdImageField(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
upload_to=dynamic_filenames.FilePattern(
|
||||||
|
filename_pattern="{model_name}/{instance.title:slug}{ext}"
|
||||||
),
|
),
|
||||||
|
validators=[stdimage.validators.MinSizeValidator(1200, 300)],
|
||||||
|
),
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
|
@ -7,29 +7,52 @@ import django.utils.timezone
|
||||||
import stdimage.models
|
import stdimage.models
|
||||||
import stdimage.utils
|
import stdimage.utils
|
||||||
import stdimage.validators
|
import stdimage.validators
|
||||||
|
import dynamic_filenames
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [("base", "0002_auto_20170214_1911")]
|
||||||
('base', '0002_auto_20170214_1911'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='BannerImage',
|
name="BannerImage",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
(
|
||||||
('url', models.URLField()),
|
"id",
|
||||||
('title', models.CharField(max_length=255)),
|
models.AutoField(
|
||||||
('displayed', models.BooleanField(default=True)),
|
auto_created=True,
|
||||||
('original_image', models.URLField(blank=True, max_length=255, null=True)),
|
primary_key=True,
|
||||||
('scaled_image', stdimage.models.StdImageField(blank=True, null=True, upload_to=stdimage.utils.UploadToAutoSlugClassNameDir('title'), validators=[stdimage.validators.MinSizeValidator(1200, 300)])),
|
serialize=False,
|
||||||
('caption', models.TextField()),
|
verbose_name="ID",
|
||||||
('date', models.DateTimeField(default=django.utils.timezone.now)),
|
),
|
||||||
|
),
|
||||||
|
("url", models.URLField()),
|
||||||
|
("title", models.CharField(max_length=255)),
|
||||||
|
("displayed", models.BooleanField(default=True)),
|
||||||
|
(
|
||||||
|
"original_image",
|
||||||
|
models.URLField(blank=True, max_length=255, null=True),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"scaled_image",
|
||||||
|
stdimage.models.StdImageField(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
upload_to=dynamic_filenames.FilePattern(
|
||||||
|
filename_pattern="{model_name}/{instance.title:slug}{ext}"
|
||||||
|
),
|
||||||
|
validators=[
|
||||||
|
stdimage.validators.MinSizeValidator(1200, 300)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.DeleteModel(
|
|
||||||
name='BannerImages',
|
|
||||||
),
|
),
|
||||||
|
("caption", models.TextField()),
|
||||||
|
(
|
||||||
|
"date",
|
||||||
|
models.DateTimeField(default=django.utils.timezone.now),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(name="BannerImages"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,6 +6,7 @@ from django.db import migrations
|
||||||
import stdimage.models
|
import stdimage.models
|
||||||
import stdimage.utils
|
import stdimage.utils
|
||||||
import stdimage.validators
|
import stdimage.validators
|
||||||
|
import dynamic_filenames
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
@ -26,7 +27,7 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='bannerimage',
|
model_name='bannerimage',
|
||||||
name='image',
|
name='image',
|
||||||
field=stdimage.models.StdImageField(default='', upload_to=stdimage.utils.UploadToAutoSlugClassNameDir('title'), validators=[stdimage.validators.MinSizeValidator(1200, 300)]),
|
field=stdimage.models.StdImageField(default='', upload_to=dynamic_filenames.FilePattern(filename_pattern="{model_name}/{instance.title:slug}{ext}"), validators=[stdimage.validators.MinSizeValidator(1200, 300)]),
|
||||||
preserve_default=False,
|
preserve_default=False,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,18 +6,22 @@ from django.db import migrations
|
||||||
import stdimage.models
|
import stdimage.models
|
||||||
import stdimage.utils
|
import stdimage.utils
|
||||||
import stdimage.validators
|
import stdimage.validators
|
||||||
|
import dynamic_filenames
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [("base", "0005_auto_20170228_2210")]
|
||||||
('base', '0005_auto_20170228_2210'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='bannerimage',
|
model_name="bannerimage",
|
||||||
name='image',
|
name="image",
|
||||||
field=stdimage.models.StdImageField(upload_to=stdimage.utils.UploadToAutoSlugClassNameDir('title'), validators=[stdimage.validators.MinSizeValidator(2400, 600)]),
|
field=stdimage.models.StdImageField(
|
||||||
|
upload_to=dynamic_filenames.FilePattern(
|
||||||
|
filename_pattern="{model_name}/{instance.title:slug}{ext}"
|
||||||
),
|
),
|
||||||
|
validators=[stdimage.validators.MinSizeValidator(2400, 600)],
|
||||||
|
),
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
|
@ -5,51 +5,39 @@ from django.conf import settings
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from stdimage.models import StdImageField
|
from stdimage.models import StdImageField
|
||||||
from stdimage.utils import UploadToAutoSlugClassNameDir
|
from dynamic_filenames import FilePattern
|
||||||
from stdimage.validators import MinSizeValidator
|
from stdimage.validators import MinSizeValidator
|
||||||
|
|
||||||
from spirit.comment.models import Comment
|
from spirit.comment.models import Comment
|
||||||
from spirit.topic.models import Topic
|
from spirit.topic.models import Topic
|
||||||
from wiki.models.article import ArticleRevision
|
from wiki.models.article import ArticleRevision
|
||||||
# from django.contrib.auth.models import User
|
|
||||||
from django.core.mail import EmailMessage
|
from django.core.mail import EmailMessage
|
||||||
from django.db.models.signals import post_save
|
from django.db.models.signals import post_save
|
||||||
from mhackspace.base.tasks import matrix_message
|
from mhackspace.base.tasks import matrix_message
|
||||||
|
|
||||||
|
|
||||||
|
upload_to_pattern = FilePattern(
|
||||||
|
filename_pattern="{model_name}/{instance.title:slug}{ext}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class BannerImage(models.Model):
|
class BannerImage(models.Model):
|
||||||
url = models.URLField()
|
url = models.URLField()
|
||||||
title = models.CharField(max_length=255)
|
title = models.CharField(max_length=255)
|
||||||
displayed = models.BooleanField(default=True)
|
displayed = models.BooleanField(default=True)
|
||||||
image = StdImageField(
|
image = StdImageField(
|
||||||
upload_to=UploadToAutoSlugClassNameDir(populate_from='title'),
|
upload_to=upload_to_pattern,
|
||||||
variations={
|
variations={
|
||||||
'small': {
|
"small": {"width": 400, "height": 300, "crop": True},
|
||||||
"width": 400,
|
"small2x": {"width": 800, "height": 600, "crop": True},
|
||||||
"height": 300,
|
"medium": {"width": 800, "height": 300, "crop": True},
|
||||||
"crop": True},
|
"medium2x": {"width": 1600, "height": 600, "crop": True},
|
||||||
'small2x': {
|
"large": {"width": 1200, "height": 300, "crop": True},
|
||||||
"width": 800,
|
"large2x": {"width": 2400, "height": 600, "crop": True},
|
||||||
"height": 600,
|
},
|
||||||
"crop": True},
|
validators=[MinSizeValidator(2400, 600)],
|
||||||
'medium': {
|
)
|
||||||
"width": 800,
|
|
||||||
"height": 300,
|
|
||||||
"crop": True},
|
|
||||||
'medium2x': {
|
|
||||||
"width": 1600,
|
|
||||||
"height": 600,
|
|
||||||
"crop": True},
|
|
||||||
'large': {
|
|
||||||
"width": 1200,
|
|
||||||
"height": 300,
|
|
||||||
"crop": True},
|
|
||||||
'large2x': {
|
|
||||||
"width": 2400,
|
|
||||||
"height": 600,
|
|
||||||
"crop": True}},
|
|
||||||
validators=[
|
|
||||||
MinSizeValidator(2400, 600)])
|
|
||||||
|
|
||||||
caption = models.TextField()
|
caption = models.TextField()
|
||||||
date = models.DateTimeField(default=timezone.now)
|
date = models.DateTimeField(default=timezone.now)
|
||||||
|
@ -64,33 +52,46 @@ def send_topic_update_email(sender, instance, **kwargs):
|
||||||
addresses = {comment.user.email for comment in comments}
|
addresses = {comment.user.email for comment in comments}
|
||||||
for user_email in addresses:
|
for user_email in addresses:
|
||||||
email = EmailMessage(
|
email = EmailMessage(
|
||||||
'[%s] - %s' % (settings.MSG_PREFIX, instance.topic.title),
|
"[%s] - %s" % (settings.MSG_PREFIX, instance.topic.title),
|
||||||
'A topic you have interacted with has been updated click link to see new comments %s' % instance.get_absolute_url(),
|
"A topic you have interacted with has been updated click link to see new comments %s"
|
||||||
'no-reply@maidstone-hackspace.org.uk',
|
% instance.get_absolute_url(),
|
||||||
|
"no-reply@maidstone-hackspace.org.uk",
|
||||||
to=[user_email],
|
to=[user_email],
|
||||||
headers={'Reply-To': 'no-reply@maidstone-hackspace.org.uk'})
|
headers={"Reply-To": "no-reply@maidstone-hackspace.org.uk"},
|
||||||
|
)
|
||||||
email.send()
|
email.send()
|
||||||
matrix_message.delay('https://%s%s' % (
|
matrix_message.delay(
|
||||||
|
"https://%s%s"
|
||||||
|
% (
|
||||||
Site.objects.get_current().domain,
|
Site.objects.get_current().domain,
|
||||||
instance.topic.get_absolute_url()))
|
instance.topic.get_absolute_url(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def wiki_article_updated(sender, instance, **kwargs):
|
def wiki_article_updated(sender, instance, **kwargs):
|
||||||
matrix_message.delay('https://%s%s' % (
|
matrix_message.delay(
|
||||||
|
"https://%s%s"
|
||||||
|
% (
|
||||||
Site.objects.get_current().domain,
|
Site.objects.get_current().domain,
|
||||||
instance.article.get_absolute_url()))
|
instance.article.get_absolute_url(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def send_new_topic_notification(sender, instance, **kwargs):
|
def send_new_topic_notification(sender, instance, **kwargs):
|
||||||
matrix_message.delay('https://%s%s' % (
|
matrix_message.delay(
|
||||||
Site.objects.get_current().domain,
|
"https://%s%s"
|
||||||
instance.get_absolute_url()))
|
% (Site.objects.get_current().domain, instance.get_absolute_url())
|
||||||
|
)
|
||||||
email = EmailMessage(
|
email = EmailMessage(
|
||||||
'[%s - TOPIC] - %s' % (settings.MSG_PREFIX, instance),
|
"[%s - TOPIC] - %s" % (settings.MSG_PREFIX, instance),
|
||||||
'A new topic has been created, click link to view %s' % instance.get_absolute_url(),
|
"A new topic has been created, click link to view %s"
|
||||||
|
% instance.get_absolute_url(),
|
||||||
settings.EMAIL_MAILING_LIST,
|
settings.EMAIL_MAILING_LIST,
|
||||||
to=[settings.EMAIL_MAILING_LIST],
|
to=[settings.EMAIL_MAILING_LIST],
|
||||||
headers={'Reply-To': settings.EMAIL_MAILING_LIST})
|
headers={"Reply-To": settings.EMAIL_MAILING_LIST},
|
||||||
|
)
|
||||||
email.send()
|
email.send()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,37 +8,68 @@ import django.db.models.deletion
|
||||||
import django.utils.timezone
|
import django.utils.timezone
|
||||||
import stdimage.models
|
import stdimage.models
|
||||||
import stdimage.utils
|
import stdimage.utils
|
||||||
|
import dynamic_filenames
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Category',
|
name="Category",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
(
|
||||||
('name', models.CharField(max_length=30)),
|
"id",
|
||||||
|
models.AutoField(
|
||||||
|
auto_created=True,
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
verbose_name="ID",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("name", models.CharField(max_length=30)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Post',
|
name="Post",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
(
|
||||||
('title', models.CharField(max_length=30)),
|
"id",
|
||||||
('image', stdimage.models.StdImageField(blank=True, null=True, upload_to=stdimage.utils.UploadToAutoSlugClassNameDir('title'))),
|
models.AutoField(
|
||||||
('description', models.TextField()),
|
auto_created=True,
|
||||||
('date', models.DateTimeField(default=django.utils.timezone.now)),
|
primary_key=True,
|
||||||
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
serialize=False,
|
||||||
('categories', models.ManyToManyField(to='blog.Category')),
|
verbose_name="ID",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("title", models.CharField(max_length=30)),
|
||||||
|
(
|
||||||
|
"image",
|
||||||
|
stdimage.models.StdImageField(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
upload_to=dynamic_filenames.FilePattern(
|
||||||
|
filename_pattern="{model_name}/{instance.title:slug}{ext}"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("description", models.TextField()),
|
||||||
|
(
|
||||||
|
"date",
|
||||||
|
models.DateTimeField(default=django.utils.timezone.now),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"author",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("categories", models.ManyToManyField(to="blog.Category")),
|
||||||
],
|
],
|
||||||
options={
|
options={"ordering": ("date",)},
|
||||||
'ordering': ('date',),
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,27 +6,32 @@ from django.db import migrations, models
|
||||||
import stdimage.models
|
import stdimage.models
|
||||||
import stdimage.utils
|
import stdimage.utils
|
||||||
import stdimage.validators
|
import stdimage.validators
|
||||||
|
import dynamic_filenames
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [("blog", "0004_auto_20170228_2210")]
|
||||||
('blog', '0004_auto_20170228_2210'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterModelOptions(
|
migrations.AlterModelOptions(
|
||||||
name='post',
|
name="post", options={"ordering": ("-published_date",)}
|
||||||
options={'ordering': ('-published_date',)},
|
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='post',
|
model_name="post",
|
||||||
name='excerpt',
|
name="excerpt",
|
||||||
field=models.TextField(blank=True, null=True),
|
field=models.TextField(blank=True, null=True),
|
||||||
),
|
),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='post',
|
model_name="post",
|
||||||
name='image',
|
name="image",
|
||||||
field=stdimage.models.StdImageField(blank=True, null=True, upload_to=stdimage.utils.UploadToAutoSlugClassNameDir('title'), validators=[stdimage.validators.MinSizeValidator(730, 410)]),
|
field=stdimage.models.StdImageField(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
upload_to=dynamic_filenames.FilePattern(
|
||||||
|
filename_pattern="{model_name}/{instance.title:slug}{ext}"
|
||||||
|
),
|
||||||
|
validators=[stdimage.validators.MinSizeValidator(730, 410)],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -5,10 +5,15 @@ from django.urls import reverse
|
||||||
from martor.models import MartorField
|
from martor.models import MartorField
|
||||||
from stdimage.validators import MinSizeValidator
|
from stdimage.validators import MinSizeValidator
|
||||||
from stdimage.models import StdImageField
|
from stdimage.models import StdImageField
|
||||||
from stdimage.utils import UploadToAutoSlugClassNameDir
|
from dynamic_filenames import FilePattern
|
||||||
|
|
||||||
|
|
||||||
from mhackspace.users.models import User
|
from mhackspace.users.models import User
|
||||||
|
|
||||||
|
upload_to_pattern = FilePattern(
|
||||||
|
filename_pattern="{model_name}/{instance.title:slug}{ext}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Category(models.Model):
|
class Category(models.Model):
|
||||||
name = models.CharField(max_length=100)
|
name = models.CharField(max_length=100)
|
||||||
|
@ -28,7 +33,7 @@ class Post(models.Model):
|
||||||
categories = models.ManyToManyField(Category)
|
categories = models.ManyToManyField(Category)
|
||||||
author = models.ForeignKey(User, on_delete=models.CASCADE)
|
author = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
image = StdImageField(
|
image = StdImageField(
|
||||||
upload_to=UploadToAutoSlugClassNameDir(populate_from="title"),
|
upload_to=upload_to_pattern,
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
variations={
|
variations={
|
||||||
|
|
|
@ -7,45 +7,87 @@ import django.db.models.deletion
|
||||||
import django.utils.timezone
|
import django.utils.timezone
|
||||||
import stdimage.models
|
import stdimage.models
|
||||||
import stdimage.utils
|
import stdimage.utils
|
||||||
|
import dynamic_filenames
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = []
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Article',
|
name="Article",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
(
|
||||||
('url', models.URLField()),
|
"id",
|
||||||
('title', models.CharField(max_length=255)),
|
models.AutoField(
|
||||||
('original_image', models.URLField(blank=True, max_length=255, null=True)),
|
auto_created=True,
|
||||||
('image', stdimage.models.StdImageField(blank=True, null=True, upload_to=stdimage.utils.UploadToAutoSlugClassNameDir('title'))),
|
primary_key=True,
|
||||||
('description', models.TextField()),
|
serialize=False,
|
||||||
('displayed', models.BooleanField(default=True)),
|
verbose_name="ID",
|
||||||
('date', models.DateTimeField(default=django.utils.timezone.now)),
|
),
|
||||||
|
),
|
||||||
|
("url", models.URLField()),
|
||||||
|
("title", models.CharField(max_length=255)),
|
||||||
|
(
|
||||||
|
"original_image",
|
||||||
|
models.URLField(blank=True, max_length=255, null=True),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"image",
|
||||||
|
stdimage.models.StdImageField(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
upload_to=dynamic_filenames.FilePattern(
|
||||||
|
filename_pattern="{model_name}/{instance.title:slug}{ext}"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("description", models.TextField()),
|
||||||
|
("displayed", models.BooleanField(default=True)),
|
||||||
|
(
|
||||||
|
"date",
|
||||||
|
models.DateTimeField(default=django.utils.timezone.now),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Feed',
|
name="Feed",
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
(
|
||||||
('home_url', models.URLField(verbose_name='Site Home Page')),
|
"id",
|
||||||
('feed_url', models.URLField(verbose_name='RSS Feed URL')),
|
models.AutoField(
|
||||||
('title', models.CharField(max_length=255)),
|
auto_created=True,
|
||||||
('author', models.CharField(max_length=255)),
|
primary_key=True,
|
||||||
('tags', models.CharField(blank=True, max_length=255)),
|
serialize=False,
|
||||||
('image', stdimage.models.StdImageField(blank=True, null=True, upload_to=stdimage.utils.UploadToAutoSlugClassNameDir('title'))),
|
verbose_name="ID",
|
||||||
('enabled', models.BooleanField(default=True)),
|
),
|
||||||
|
),
|
||||||
|
("home_url", models.URLField(verbose_name="Site Home Page")),
|
||||||
|
("feed_url", models.URLField(verbose_name="RSS Feed URL")),
|
||||||
|
("title", models.CharField(max_length=255)),
|
||||||
|
("author", models.CharField(max_length=255)),
|
||||||
|
("tags", models.CharField(blank=True, max_length=255)),
|
||||||
|
(
|
||||||
|
"image",
|
||||||
|
stdimage.models.StdImageField(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
upload_to=dynamic_filenames.FilePattern(
|
||||||
|
filename_pattern="{model_name}/{instance.title:slug}{ext}"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("enabled", models.BooleanField(default=True)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='article',
|
model_name="article",
|
||||||
name='feed',
|
name="feed",
|
||||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='feeds.Feed'),
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE, to="feeds.Feed"
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -5,10 +5,13 @@ from django.db import models
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
from stdimage.models import StdImageField
|
from stdimage.models import StdImageField
|
||||||
from stdimage.utils import UploadToAutoSlugClassNameDir
|
from dynamic_filenames import FilePattern
|
||||||
|
|
||||||
|
|
||||||
image_variations = {"home": {"width": 530, "height": 220, "crop": True}}
|
image_variations = {"home": {"width": 530, "height": 220, "crop": True}}
|
||||||
|
upload_to_pattern = FilePattern(
|
||||||
|
filename_pattern="{model_name}/{instance.title:slug}{ext}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
|
@ -19,7 +22,7 @@ class Feed(models.Model):
|
||||||
author = models.CharField(max_length=255)
|
author = models.CharField(max_length=255)
|
||||||
tags = models.CharField(max_length=255, blank=True)
|
tags = models.CharField(max_length=255, blank=True)
|
||||||
image = StdImageField(
|
image = StdImageField(
|
||||||
upload_to=UploadToAutoSlugClassNameDir(populate_from="title"),
|
upload_to=upload_to_pattern,
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
variations=image_variations,
|
variations=image_variations,
|
||||||
|
@ -36,7 +39,7 @@ class Article(models.Model):
|
||||||
title = models.CharField(max_length=255)
|
title = models.CharField(max_length=255)
|
||||||
original_image = models.URLField(max_length=255, blank=True, null=True)
|
original_image = models.URLField(max_length=255, blank=True, null=True)
|
||||||
image = StdImageField(
|
image = StdImageField(
|
||||||
upload_to=UploadToAutoSlugClassNameDir(populate_from="title"),
|
upload_to=upload_to_pattern,
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
variations=image_variations,
|
variations=image_variations,
|
||||||
|
|
|
@ -46,7 +46,7 @@ class RequestsDetail(LoginRequiredMixin, DetailView):
|
||||||
|
|
||||||
def get_context_data(self, *args, **kwargs):
|
def get_context_data(self, *args, **kwargs):
|
||||||
context = super(RequestsDetail, self).get_context_data(*args, **kwargs)
|
context = super(RequestsDetail, self).get_context_data(*args, **kwargs)
|
||||||
context['requests_comments'] = UserRequestsComment.objects.all()
|
context['request_comments'] = UserRequestsComment.objects.all()
|
||||||
context['form'] = UserRequestFormComment
|
context['form'] = UserRequestFormComment
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
|
@ -6,24 +6,27 @@
|
||||||
{% block head-open-graph %}
|
{% block head-open-graph %}
|
||||||
<meta property="og:title" content="New request made" />
|
<meta property="og:title" content="New request made" />
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:url" content="{{ request.build_absolute_uri }}" />
|
<meta property="og:url" content="{{ request_detail.get_absolute_url }}" />
|
||||||
<meta property="og:image" content="https://maidstone-hackspace.org.uk/static/images/android-chrome-192x192.png" />
|
<meta property="og:image" content="https://maidstone-hackspace.org.uk/static/images/android-chrome-192x192.png" />
|
||||||
{% endblock head-open-graph %}
|
{% endblock head-open-graph %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{{requests.title}}</h2>
|
<h2>{{request_detail.title}}</h2>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
{{requests.description}}
|
{{request_detail.description}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% for comment in requests_comments %}
|
{% for comment in request_comments %}
|
||||||
<b>{{ comment.user }}</b>
|
<b>{{ comment.user }}</b>
|
||||||
<p>{{ comment.comment }}</p>
|
<p>{{ comment.comment }}</p>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<p>Add comments below</p>
|
||||||
{% if form %}
|
{% if form %}
|
||||||
<form method="POST" action="{% url 'requests_detail_form' request_detail.id %}" class="requests_detail_form">
|
<form method="POST" action="{% url 'requests_detail_form' request_detail.id %}" class="requests_detail_form">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
|
@ -27,5 +27,6 @@
|
||||||
<script type="text/javascript" src="{% static 'plugins/js/highlight.min.js' %}"></script>
|
<script type="text/javascript" src="{% static 'plugins/js/highlight.min.js' %}"></script>
|
||||||
<script type="text/javascript" src="{% static 'plugins/js/resizable.min.js' %}"></script>
|
<script type="text/javascript" src="{% static 'plugins/js/resizable.min.js' %}"></script>
|
||||||
<script type="text/javascript" src="{% static 'plugins/js/emojis.min.js' %}"></script>
|
<script type="text/javascript" src="{% static 'plugins/js/emojis.min.js' %}"></script>
|
||||||
<script type="text/javascript" src="{% static 'martor/js/martor.min.js' %}"></script>
|
<script type="text/javascript" src="{% static 'martor/js/martor.js' %}"></script>
|
||||||
|
|
||||||
{% endaddtoblock %}
|
{% endaddtoblock %}
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
wheel==0.31.1
|
wheel==0.31.1
|
||||||
# Bleeding edge Django
|
# Bleeding edge Django
|
||||||
django==2.1.1
|
django==2.1.1
|
||||||
|
django-dynamic-filenames==1.1.3
|
||||||
# Configuration
|
# Configuration
|
||||||
django-environ==0.4.5
|
django-environ==0.4.5
|
||||||
whitenoise==4.0
|
whitenoise==4.0
|
||||||
# Static and Media Storage
|
# Static and Media Storage
|
||||||
# ------------------------------------------------
|
# ------------------------------------------------
|
||||||
boto3==1.8.6
|
boto3==1.9.1
|
||||||
django-storages==1.7
|
django-storages==1.7.1
|
||||||
# django-storages-redux==1.3.2
|
# django-storages-redux==1.3.2
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ django-extensions==2.1.2
|
||||||
Werkzeug==0.14.1
|
Werkzeug==0.14.1
|
||||||
|
|
||||||
# Models
|
# Models
|
||||||
django-stdimage==3.2.0
|
django-stdimage==4.0.0
|
||||||
django-model-utils==3.1.2
|
django-model-utils==3.1.2
|
||||||
|
|
||||||
# Images
|
# Images
|
||||||
|
@ -56,7 +56,7 @@ django-compressor==2.2
|
||||||
#django-sass-processor==0.5.7
|
#django-sass-processor==0.5.7
|
||||||
git+https://github.com/jrief/django-sass-processor.git
|
git+https://github.com/jrief/django-sass-processor.git
|
||||||
libsass==0.14.5
|
libsass==0.14.5
|
||||||
lxml==4.2.4
|
lxml==4.2.5
|
||||||
|
|
||||||
# WSGI Handler
|
# WSGI Handler
|
||||||
# ------------------------------------------------
|
# ------------------------------------------------
|
||||||
|
@ -68,7 +68,7 @@ gunicorn==19.9.0
|
||||||
# Your custom requirements go here
|
# Your custom requirements go here
|
||||||
mock==2.0.0
|
mock==2.0.0
|
||||||
|
|
||||||
gocardless_pro
|
gocardless_pro==1.8.0
|
||||||
braintree==3.48.0
|
braintree==3.48.0
|
||||||
|
|
||||||
django-autofixture==0.12.1
|
django-autofixture==0.12.1
|
||||||
|
@ -79,17 +79,18 @@ git+git://github.com/django-wiki/django-wiki.git
|
||||||
|
|
||||||
djangorestframework==3.8.2
|
djangorestframework==3.8.2
|
||||||
djangorestframework-jwt==1.11.0
|
djangorestframework-jwt==1.11.0
|
||||||
django-filter==2.0
|
django-filter==2.0.0
|
||||||
coreapi
|
coreapi==2.3.3
|
||||||
# api libraries end
|
# api libraries end
|
||||||
|
|
||||||
martor==1.3.2
|
martor==1.3.2
|
||||||
|
|
||||||
#git+git://github.com/olymk2/django-markdown-editor.git
|
#git+git://github.com/olymk2/django-markdown-editor.git
|
||||||
|
|
||||||
django-spirit==0.6.0
|
django-spirit==0.6.1
|
||||||
django-djconfig
|
django-djconfig==0.8.0
|
||||||
django-haystack
|
django-haystack==2.8.1
|
||||||
|
git+https://github.com/nitely/Spirit.git
|
||||||
django-xforwardedfor-middleware==2.0
|
django-xforwardedfor-middleware==2.0
|
||||||
|
|
||||||
# Application queue celery
|
# Application queue celery
|
||||||
|
@ -97,9 +98,9 @@ celery==4.2.1
|
||||||
django-celery-results==1.0.1
|
django-celery-results==1.0.1
|
||||||
django-celery-beat==1.1.1
|
django-celery-beat==1.1.1
|
||||||
|
|
||||||
argon2-cffi
|
argon2-cffi==18.3.0
|
||||||
django-cors-headers
|
django-cors-headers==2.4.0
|
||||||
python-magic
|
python-magic==0.4.15
|
||||||
ldap3
|
ldap3==2.5.1
|
||||||
bcrypt==3.1.4
|
bcrypt==3.1.4
|
||||||
python-twitter==3.4.2
|
python-twitter==3.4.2
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
# Email backends for Mailgun, Postmark, SendGrid and more
|
# Email backends for Mailgun, Postmark, SendGrid and more
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
django-anymail==0.10
|
django-anymail==4.2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue