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