Commit e5134913 authored by Mirko Vucicevich's avatar Mirko Vucicevich
Browse files

Added markdown editor for description

parent 95c62049
......@@ -2,6 +2,7 @@ from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import Group as UselessGroup
from projector.models import *
from markdownx.admin import MarkdownxModelAdmin
admin.AdminSite.index_template = 'admin-extra/index.html'
......@@ -45,7 +46,7 @@ class NoticeInline(admin.StackedInline):
extra = 1
class ProjectAdmin(admin.ModelAdmin):
class ProjectAdmin(MarkdownxModelAdmin):
search_fields = ['title']
list_filter = ['groups__name']
list_display = ['title', 'url', 'get_groups']
......
......@@ -4,6 +4,7 @@ from django.db import models
from imagekit.models import ProcessedImageField
from imagekit.processors import ResizeToFill
from django.conf import settings
from markdownx.models import MarkdownxField
from requests import get
import markdown
......@@ -24,7 +25,7 @@ class Project(models.Model):
max_length=100,
help_text="Short, catchy sentence about the project"
)
description = models.TextField(
description = MarkdownxField(
help_text="Markdown-formatted project description"
)
technologies = models.ManyToManyField('projector.Technology', blank=True)
......
......@@ -13,6 +13,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'corsheaders',
'markdownx',
'projector',
'overlay',
]
......
......@@ -17,7 +17,9 @@ from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from projector import views # NEW
from django.conf.urls import url
from markdownx import urls as markdownx
from projector import views
from overlay.views import send_message, project_json_view
try:
from projector.local_urls import urlpatterns as custom_url_patterns
......@@ -27,6 +29,9 @@ except:
urlpatterns = [
path('', include(custom_url_patterns)),
path('', views.IndexView.as_view(), name='index'),
path('about/', views.about, name='about'),
path('admin/', admin.site.urls),
url(r'^markdownx/', include('markdownx.urls')),
# Until we deprecate PK, both int and PK work :)
path('<int:pk>/', views.DetailView.as_view(), name='detail'),
path('<int:pk>/json', project_json_view, name='json-detail'),
......@@ -34,7 +39,5 @@ urlpatterns = [
path('<slug:slug>/', views.DetailView.as_view(), name='detail'),
path('<slug:slug>/json', project_json_view, name='json-detail'),
path('<slug:slug>/send-message', send_message, name='send-message'),
path('about/', views.about, name='about'),
path('admin/', admin.site.urls),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
......@@ -4,4 +4,4 @@ django-cors-headers==3.1.*
Markdown==3.*
Pillow==6.2.*
requests==2.22.*
django-markdownx==3.0.*
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment