diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml index 2f16c77..b1ff2b0 100644 --- a/.github/workflows/deploy_docs.yml +++ b/.github/workflows/deploy_docs.yml @@ -5,16 +5,16 @@ on: types: [ created ] push: - branches: [ master ] + branches: [ master, actions ] jobs: deploy: runs-on: ubuntu-latest steps: - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python 3.10 uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} + python-version: "3.10" - name: Checkout branch uses: actions/checkout@v2.3.2 @@ -26,8 +26,10 @@ jobs: - name: Commit documentation changes run: | - git clone https://github.com/publichealthengland/coronavirus-dashboard-api-python-sdk.git --branch gh-pages --single-branch gh-pages - cp -r docs/* gh-pages/ + git clone https://github.com/neutronX/django-markdownx.git --branch gh-pages --single-branch gh-pages + rm -rf gh-pages/docs + mkdir gh-pages/docs + cp -r docs/* gh-pages/docs/ cd gh-pages VERSION=$(python setup.py -V) echo ${VERSION} >> version diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index b0f8f56..32b4939 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -10,11 +10,18 @@ jobs: strategy: matrix: - os: [ macos-latest, ubuntu-latest, windows-latest ] + os: [ macos-latest, ubuntu-latest ] python-version: [ 3.9, "3.10" ] django-version: [ 3.1, 3.2, 4.0 ] steps: + - name: Install system dependencies (windows) + if: matrix.os == 'windows-latest' + uses: msys2/setup-msys2@v2 + with: + update: true + install: zlib + - uses: actions/checkout@v2.3.2 - name: Set up Python ${{ matrix.python-version }} @@ -38,22 +45,25 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.8' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* + - uses: actions/checkout@v2.3.2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + + - name: Build and publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* docs: needs: @@ -69,7 +79,9 @@ jobs: - name: Commit documentation changes run: | git clone https://github.com/publichealthengland/coronavirus-dashboard-api-python-sdk.git --branch gh-pages --single-branch gh-pages - cp -r docs/* gh-pages/ + rm -rf gh-pages/docs + mkdir gh-pages/docs + cp -r docs/* gh-pages/docs/ cd gh-pages VERSION=$(python setup.py -V) echo ${VERSION} >> version diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 3159ada..095ba24 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -2,10 +2,10 @@ name: Python package on: push: - branches: [ master ] + branches: [ master, actions ] pull_request: - branches: [ master ] + branches: [ master, actions ] jobs: build: @@ -13,11 +13,18 @@ jobs: strategy: matrix: - os: [ macos-latest, ubuntu-latest, windows-latest ] + os: [ macos-latest, ubuntu-latest ] python-version: [ 3.9, "3.10" ] django-version: [ 3.1, 3.2, 4.0 ] steps: + - name: Install system dependencies (windows) + if: matrix.os == 'windows-latest' + uses: msys2/setup-msys2@v2 + with: + update: true + install: zlib + - uses: actions/checkout@v2.3.2 - name: Set up Python ${{ matrix.python-version }} diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/markdownx/tests/urls.py b/markdownx/tests/urls.py index 6f7a3b9..ab65bf4 100644 --- a/markdownx/tests/urls.py +++ b/markdownx/tests/urls.py @@ -6,6 +6,6 @@ except ImportError: from .views import TestView urlpatterns = [ - url(r'testview/$', TestView.as_view()), - url(r'markdownx/$', include('markdownx.urls')), + url(r'^testview/', TestView.as_view()), + url(r'^markdownx/', include('markdownx.urls')), ] diff --git a/markdownx/tests/views.py b/markdownx/tests/views.py index b743a73..899be54 100644 --- a/markdownx/tests/views.py +++ b/markdownx/tests/views.py @@ -2,6 +2,7 @@ from django.views.generic.edit import CreateView from .models import MyModel + class TestView(CreateView): template_name = "test_view.html" model = MyModel diff --git a/markdownx/views.py b/markdownx/views.py index 33ca64d..add592f 100755 --- a/markdownx/views.py +++ b/markdownx/views.py @@ -73,7 +73,7 @@ class ImageUploadView(BaseFormView): """ response = super(ImageUploadView, self).form_valid(form) - if self.request.is_ajax(): + if self.request.headers.get('x-requested-with') == 'XMLHttpRequest': image_path = form.save(commit=True) image_code = '![]({})'.format(image_path) return JsonResponse({'image_code': image_code}) diff --git a/version b/version new file mode 100644 index 0000000..fcdb2e1 --- /dev/null +++ b/version @@ -0,0 +1 @@ +4.0.0