Skip to content

Commit

Permalink
Merge pull request #989 from ubyssey/admin-experiment
Browse files Browse the repository at this point in the history
Allow Dispatch to work with Django's default admin interface
  • Loading branch information
keeganland authored Mar 7, 2021
2 parents 5bd0dce + 1bf9a5a commit 1329e7d
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 7 deletions.
7 changes: 7 additions & 0 deletions dispatch/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.contrib import admin

# Register your models here.

from .models import Section

admin.site.register(Section)
2 changes: 1 addition & 1 deletion dispatch/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from dispatch.modules.auth.models import Person, User, Invite
from dispatch.modules.podcasts.models import Podcast, PodcastEpisode

from dispatch.admin.registration import send_invitation
from dispatch.dispatchadmin.registration import send_invitation
from dispatch.theme.exceptions import WidgetNotFound, InvalidField

from dispatch.api.mixins import DispatchModelSerializer, DispatchPublishableSerializer
Expand Down
2 changes: 1 addition & 1 deletion dispatch/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from dispatch.modules.podcasts.models import Podcast, PodcastEpisode

from dispatch.core.settings import get_settings
from dispatch.admin.registration import reset_password
from dispatch.dispatchadmin.registration import reset_password

from dispatch.api.mixins import DispatchModelViewSet, DispatchPublishableMixin
from dispatch.api.serializers import (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion dispatch/admin/urls.py → dispatch/dispatchadmin/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django.contrib.auth import views as auth_views
from django.conf import settings
from django.shortcuts import render
from dispatch.admin import views
from dispatch.dispatchadmin import views
import dispatch

def admin(request):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from django.contrib.auth.models import Group
from dispatch.models import Invite
from dispatch.admin.forms import SignUpForm
from dispatch.dispatchadmin.forms import SignUpForm

from django.http import Http404

Expand Down
9 changes: 9 additions & 0 deletions dispatch/modules/auth/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ def modify_permissions(self, permissions):
else:
self.groups.remove(group)

@property
def is_staff(self):
#TODO: REPLACE WITH SOMETHING LESS DANGEROUS???
return True
# permissions = self.get_permissions
# if permissions == 'admin':
# return True
# return False

class Invite(Model):
id = UUIDField(default=uuid.uuid4, primary_key=True)
email = CharField(max_length=255, unique=True)
Expand Down
2 changes: 1 addition & 1 deletion dispatch/tests/test_api_invites.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from dispatch.tests.cases import DispatchAPITestCase, DispatchMediaTestMixin
from dispatch.tests.test_api_persons import PersonsTests
from dispatch.tests.helpers import DispatchTestHelpers
from dispatch.admin.forms import SignUpForm
from dispatch.dispatchadmin.forms import SignUpForm


TEST_USER_EMAIL = '[email protected]'
Expand Down
2 changes: 1 addition & 1 deletion dispatch/urls.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from dispatch.admin import urls as admin_urls
from dispatch.dispatchadmin import urls as admin_urls
from dispatch.api import urls as api_urls
from dispatch.modules.podcasts import urls as podcasts_urls
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(name='dispatch',
description='A publishing platform for modern newspapers',
version='1.3.12',
version='1.3.13',
url='https://github.com/ubyssey/dispatch',
author='Peter Siemens',
author_email='[email protected]',
Expand Down

0 comments on commit 1329e7d

Please sign in to comment.