diff --git a/news/forms.py b/news/forms.py index 3874a87..6de3f19 100644 --- a/news/forms.py +++ b/news/forms.py @@ -19,6 +19,8 @@ class PostForm(forms.Form): today_formatted = today.strftime("%Y-%m-%d %H:%M:%S") image = forms.FileField(required=False) + tags = forms.CharField(label='Tags (separated by a comma)', max_length=200, required=False) + pub_date = forms.DateTimeField(label='Optional publication date, example: ' + today_formatted, required=False) class SigninForm(forms.Form): diff --git a/news/migrations/0006_auto_20191009_1004.py b/news/migrations/0006_auto_20191009_1004.py new file mode 100644 index 0000000..d66c7ed --- /dev/null +++ b/news/migrations/0006_auto_20191009_1004.py @@ -0,0 +1,35 @@ +# Generated by Django 2.2.6 on 2019-10-09 10:04 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('news', '0005_auto_20190918_0918'), + ] + + operations = [ + migrations.AlterField( + model_name='comment', + name='voters', + field=models.ManyToManyField(blank=True, related_name='voted_comments', to=settings.AUTH_USER_MODEL), + ), + migrations.AlterField( + model_name='player', + name='post', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='news.Post'), + ), + migrations.AlterField( + model_name='post', + name='author', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), + ), + migrations.AlterField( + model_name='tag', + name='post', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='news.Post'), + ), + ] diff --git a/news/migrations/0007_auto_20191009_1009.py b/news/migrations/0007_auto_20191009_1009.py new file mode 100644 index 0000000..210df31 --- /dev/null +++ b/news/migrations/0007_auto_20191009_1009.py @@ -0,0 +1,22 @@ +# Generated by Django 2.2.6 on 2019-10-09 10:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('news', '0006_auto_20191009_1004'), + ] + + operations = [ + migrations.RemoveField( + model_name='tag', + name='post', + ), + migrations.AddField( + model_name='tag', + name='post', + field=models.ManyToManyField(blank=True, null=True, to='news.Post'), + ), + ] diff --git a/news/models.py b/news/models.py index 52e4525..9020bb0 100644 --- a/news/models.py +++ b/news/models.py @@ -12,7 +12,7 @@ class PostState(Enum): USER_SUBMITTED = 3 class Post(models.Model): - author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) + author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True) title = models.CharField(max_length=200) body = models.CharField(max_length=10000) url = models.CharField(max_length=200) @@ -39,6 +39,10 @@ class Post(models.Model): flat.extend(children) return flat + def formatted_tags(self): + tag_names = map(lambda t: t.name, self.tag_set.all()) + return ", ".join(tag_names) + class Comment(models.Model): author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, null=True) post = models.ForeignKey(Post, on_delete=models.CASCADE) @@ -68,7 +72,7 @@ class Comment(models.Model): class Player(models.Model): name = models.CharField(max_length=100) - post = models.ForeignKey(Post, on_delete=models.CASCADE) + post = models.ForeignKey(Post, on_delete=models.SET_NULL, null=True) image_url = models.CharField(max_length=100) def __str__(self): @@ -77,6 +81,6 @@ class Player(models.Model): class Tag(models.Model): name = models.CharField(max_length=100) - post = models.ForeignKey(Post, on_delete=models.CASCADE) + post = models.ManyToManyField(Post, null=True, blank=True) def __str__(self): return self.name diff --git a/news/static/news/css/app.css b/news/static/news/css/app.css index b0655d2..af9faae 100644 --- a/news/static/news/css/app.css +++ b/news/static/news/css/app.css @@ -181,13 +181,13 @@ a h1 { position: relative; color: white; /* border-bottom: 0px solid #111; */ - border-top: 20px solid #111; + /* border-top: 20px solid #111; */ } @media print, screen and (min-width: 40em) { .imgcontainer { width: 600px; /* border-bottom: 10px solid #111; */ - border-top: 20px solid #111; + /* border-top: 20px solid #111; */ } } diff --git a/news/templates/base.html b/news/templates/base.html index 49a5f9f..b94b408 100644 --- a/news/templates/base.html +++ b/news/templates/base.html @@ -8,6 +8,22 @@
+ This site is owned by Stax River. + It is hosted by ALWAYSDATA, 91 rue du Faubourg Saint-Honoré, 75008 Paris (phone: +33 1 84 16 23 40). +
+ +{% endblock content %} diff --git a/news/templates/news/static/contact.html b/news/templates/news/static/contact.html index 5d5acce..5bf2e81 100644 --- a/news/templates/news/static/contact.html +++ b/news/templates/news/static/contact.html @@ -1,13 +1,13 @@ {% extends "base.html" %} -{% block title %}Contact{% endblock %} +{% block title %}Contact - Poker Rumble{% endblock %} {% block content %}- Please contact us directly on social media! + Please contact us directly on social media, @pokerrumble on twitter and instagram!
{% endblock content %} diff --git a/news/templates/news/user/password_reset_html_email.html b/news/templates/news/user/password_reset_html_email.html index 234bfef..f6bcfad 100644 --- a/news/templates/news/user/password_reset_html_email.html +++ b/news/templates/news/user/password_reset_html_email.html @@ -1,3 +1,3 @@ -Someone asked for password reset for email {{ email }}. -Follow the link below: +Someone asked for a password reset for email {{ email }}. +Please follow the link below: {{ protocol}}://{{ domain }}{% url 'news:password_reset_confirm' uidb64=uid token=token %} diff --git a/news/urls.py b/news/urls.py index f8f4936..48f2a90 100644 --- a/news/urls.py +++ b/news/urls.py @@ -8,6 +8,7 @@ app_name = 'news' urlpatterns = [ # Static path('contact', TemplateView.as_view(template_name='news/static/contact.html'), name='contact'), + path('about', TemplateView.as_view(template_name='news/static/about.html'), name='about'), # Posts path('', views.index, name='index'), path('