diff --git a/wazimap_np/admin.py b/wazimap_np/admin.py new file mode 100644 index 0000000..20b1db7 --- /dev/null +++ b/wazimap_np/admin.py @@ -0,0 +1,8 @@ +from django.contrib import admin +from .models import BlogEntry + + +@admin.register(BlogEntry) +class BlogEntryAdmin(admin.ModelAdmin): + ordering = ['-last_updated_on'] + prepopulated_fields = {"slug": ("title",)} diff --git a/wazimap_np/blog.py b/wazimap_np/blog.py new file mode 100644 index 0000000..63206b3 --- /dev/null +++ b/wazimap_np/blog.py @@ -0,0 +1,11 @@ +from .models import BlogEntry +from django.views.generic import TemplateView + + +class BlogEntryView(TemplateView): + template_name = 'blog/blog_entry.html' + + def get_context_data(self, *args, **kwargs): + return { + 'blogs': BlogEntry.objects.all(), + } diff --git a/wazimap_np/migrations/0001_initial.py b/wazimap_np/migrations/0001_initial.py new file mode 100644 index 0000000..c97d7fa --- /dev/null +++ b/wazimap_np/migrations/0001_initial.py @@ -0,0 +1,25 @@ +# Generated by Django 2.2.6 on 2022-08-08 00:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='BlogEntry', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created_on', models.DateTimeField(auto_created=True)), + ('title', models.CharField(max_length=200, unique=True)), + ('slug', models.SlugField(max_length=255, unique=True)), + ('description', models.TextField(default='enter content here...', verbose_name='content')), + ('last_updated_on', models.DateTimeField(auto_now_add=True)), + ], + ), + ] diff --git a/wazimap_np/migrations/__init__.py b/wazimap_np/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/wazimap_np/models.py b/wazimap_np/models.py new file mode 100644 index 0000000..9a64b82 --- /dev/null +++ b/wazimap_np/models.py @@ -0,0 +1,12 @@ +from django.db import models + + +class BlogEntry(models.Model): + title = models.CharField(max_length=200, null=False, blank=False, unique=True) + slug = models.SlugField(max_length=255, null=False, blank=False, unique=True) + description = models.TextField(default='enter content here...', verbose_name='content') + created_on = models.DateTimeField(auto_created=True) + last_updated_on = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return self.title diff --git a/wazimap_np/settings.py b/wazimap_np/settings.py index f3827ce..965e588 100644 --- a/wazimap_np/settings.py +++ b/wazimap_np/settings.py @@ -10,6 +10,8 @@ DATABASES['default'] = dj_database_url.parse(DATABASE_URL) DATABASES['default']['ATOMIC_REQUESTS'] = True +USE_TZ = False + SCHEME = 'http' if (os.environ.get('APP_ENV', 'dev') == 'dev') else 'https' URL = SCHEME+'://'+'nepalmap.org' diff --git a/wazimap_np/templates/blog/_base.html b/wazimap_np/templates/blog/_base.html new file mode 100644 index 0000000..129b2dd --- /dev/null +++ b/wazimap_np/templates/blog/_base.html @@ -0,0 +1,107 @@ +{% extends '_base.html' %}{% load staticfiles %} + +{% block favicon %} + +{% endblock favicon %} + +{% block head_twitter_tags %} +{% if WAZIMAP.twittercard %} + + + +{% endif %} +{% endblock %} + +{% block header %} + +{% block header_content %}{% endblock header_content %} +{% endblock %} + +{% block footer_content %} +
+ + +
+
+ +
+
+ +
+
+ +
+{% endblock footer_content %} \ No newline at end of file diff --git a/wazimap_np/templates/blog/blog_entry.html b/wazimap_np/templates/blog/blog_entry.html new file mode 100644 index 0000000..f2fb2e0 --- /dev/null +++ b/wazimap_np/templates/blog/blog_entry.html @@ -0,0 +1,9 @@ +{% extends 'about.html' %}{% load partition staticfiles %} + +{% block content %} +
+
+

{{ WAZIMAP.name }} Blog Detail

+
+
+{% endblock %} diff --git a/wazimap_np/templates/blog/blog_list.html b/wazimap_np/templates/blog/blog_list.html new file mode 100644 index 0000000..99bb013 --- /dev/null +++ b/wazimap_np/templates/blog/blog_list.html @@ -0,0 +1,9 @@ +{% extends 'about.html' %}{% load partition staticfiles %} + +{% block content %} +
+
+

{{ WAZIMAP.name }} Blogs

+
+
+{% endblock %} diff --git a/wazimap_np/urls.py b/wazimap_np/urls.py new file mode 100644 index 0000000..80663dd --- /dev/null +++ b/wazimap_np/urls.py @@ -0,0 +1,10 @@ +from django.conf.urls import url +from wazimap.urls import urlpatterns +from blog import BlogEntryView + +urlpatterns += [ + url( + regex="^blog$", + view=BlogEntryView.as_view() + ), +]