Skip to content

Commit

Permalink
Merge pull request #54 from dgk/feature/django3-merge-fix
Browse files Browse the repository at this point in the history
django 3-4 support
  • Loading branch information
dgk authored Sep 12, 2023
2 parents ddba74b + a44631b commit ce13f33
Show file tree
Hide file tree
Showing 57 changed files with 544 additions and 555 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: codecov

on:
pull_request:
branches:
- master
- develop

jobs:
main:
runs-on: ubuntu-latest

env:
DJANGO_SETTINGS_MODULE: sites.test.settings

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install "Django>=4.2,<4.3"
python -m pip install -r requirements.test.txt
python -m pip install codecov
- name: Test
run: |
python -m pip install "Django>=4.2,<4.3"
python -m pip install -r requirements.test.txt
python -m pip install codecov
- name: Run tests and collect coverage
run: |
coverage run manage.py test tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: release

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
main:
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/django-business-logic

permissions:
id-token: write
contents: write

steps:

- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install wheel
- name: Build package
run: |
python setup.py sdist bdist_wheel
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}

- name: Create Release
id: create_release
uses: comnoco/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref_name }}
body: |
Pypi release: https://pypi.org/project/django-business-logic/${{ github.ref_name }}/
draft: false
prerelease: false
59 changes: 59 additions & 0 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: unittests

on:
pull_request:
branches:
- master
- develop

jobs:
main:
runs-on: ubuntu-latest

strategy:
matrix:
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
django:
- "3.2"
- "4.0"
- "4.1"
- "4.2"

env:
DJANGO_SETTINGS_MODULE: sites.test.settings

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Set up pip
run: |
python -m pip install --upgrade pip
- name: Install Django ${{ matrix.django }}
run: |
DJANGO_VERSION_MAJOR=$(echo ${{ matrix.django }} | cut -d. -f1)
DJANGO_VERSION_NEXT_MINOR=$(($(echo ${{ matrix.django }} | cut -d. -f2) + 1))
python -m pip install "Django>=${{ matrix.django }},<$DJANGO_VERSION_MAJOR.$DJANGO_VERSION_NEXT_MINOR"
- name: Install django-admin-sortable2 for Django 3.2
if: ${{ matrix.django == '3.2' }}
run: |
python -m pip install django-admin-sortable2==1.0.4
- name: Install dependencies
run: |
python -m pip install -r requirements.test.txt
- name: Test
run: |
py.test tests
73 changes: 0 additions & 73 deletions .travis.yml

This file was deleted.

9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.6-alpine
FROM python:3.9-alpine

ARG VERSION
ARG VCS_REF
Expand All @@ -14,11 +14,12 @@ LABEL org.label-schema.schema-version="1.0" \
RUN mkdir /app
WORKDIR app

RUN apk add --no-cache libxslt && \
apk add --no-cache --virtual .build-deps g++ python3-dev libffi-dev openssl-dev libxslt-dev git

ADD . /app

RUN apk add --no-cache libxslt && \
apk add --no-cache --virtual .build-deps g++ python-dev libffi-dev openssl-dev libxslt-dev git && \
pip install -r requirements.dev.txt && \
RUN pip install -r requirements.dev.txt && \
python setup.py install && \
apk del .build-deps

Expand Down
16 changes: 7 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. image:: https://img.shields.io/travis/dgk/django-business-logic/master.svg
:target: http://travis-ci.org/dgk/django-business-logic?branch=master
:alt: travis-ci
.. image:: https://img.shields.io/github/actions/workflow/status/dgk/django-business-logic/unittests.yml
:target: https://github.com/dgk/django-business-logic/actions/workflows/unittests.yml
:alt: github-build

.. image:: https://img.shields.io/codecov/c/github/dgk/django-business-logic.svg
:target: https://codecov.io/gh/dgk/django-business-logic
Expand All @@ -18,6 +18,10 @@
:target: https://django-business-logic.readthedocs.io/en/latest/license.html
:alt: MIT license

.. image:: https://app.fossa.com/api/projects/git%2Bgithub.com%2Fdgk%2Fdjango-business-logic.svg?type=shield&issueType=license
:target: https://app.fossa.com/projects/git%2Bgithub.com%2Fdgk%2Fdjango-business-logic?ref=badge_shield
:alt: FOSSA Status

.. image:: https://img.shields.io/pypi/pyversions/django-business-logic.svg
:target: https://pypi.org/project/django-business-logic/
:alt: python versions
Expand All @@ -34,10 +38,6 @@
:target: https://pypi.org/project/django-business-logic/
:alt: pypi versions status

.. image:: https://img.shields.io/gitter/room/django-business-logic/community.svg
:target: https://gitter.im/django-business-logic/community
:alt: gitter

Preface
#######

Expand Down Expand Up @@ -114,8 +114,6 @@ Support us

Any feedback and github stars would be greatly appreciated.

Please feel free to ask any questions in the `gitter chat <https://gitter.im/django-business-logic/community>`_

If you are familiar with react/mobx and want to help to build django-business-logic library
(`next generation frontend code is here <https://github.com/dgk/business-logic-ui/>`_), please contact me [email protected].

Expand Down
2 changes: 1 addition & 1 deletion business_logic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-

__version__ = '0.5.5'
__version__ = '0.5.8'
6 changes: 3 additions & 3 deletions business_logic/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from polymorphic.admin import PolymorphicChildModelAdmin
from polymorphic.admin import PolymorphicParentModelAdmin

from adminsortable2.admin import SortableInlineAdminMixin
from adminsortable2.admin import SortableInlineAdminMixin, SortableAdminMixin, SortableAdminBase

from ace_overlay.widgets import AceOverlayWidget

Expand Down Expand Up @@ -99,7 +99,7 @@ class FunctionArgumentChoiceAdmin(SortableInlineAdminMixin, admin.TabularInline)
extra = 1


class FunctionArgumentAdmin(admin.ModelAdmin):
class FunctionArgumentAdmin(SortableAdminMixin, admin.ModelAdmin):
model = FunctionArgument
inlines = (FunctionArgumentChoiceAdmin,)
readonly_fields = ('function', 'order')
Expand All @@ -116,7 +116,7 @@ class FunctionArgumentInline(SortableInlineAdminMixin, admin.StackedInline):
show_change_link = True


class FunctionDefinitionAdmin(PolymorphicChildModelAdmin):
class FunctionDefinitionAdmin(PolymorphicChildModelAdmin, SortableAdminBase):
inlines = (FunctionArgumentInline,)


Expand Down
6 changes: 6 additions & 0 deletions business_logic/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class BusinessLogicConfig(AppConfig):
name = 'business_logic'
default_auto_field = 'django.db.models.AutoField'
1 change: 0 additions & 1 deletion business_logic/blockly/build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import inspect
import logging
Expand Down
4 changes: 2 additions & 2 deletions business_logic/blockly/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ def create_variable_definitions(self, data, external_variable_definitions=None):
if not isinstance(variable_definition, VariableDefinition):
raise NodeTreeCreatorException('Invalid variable_definition argument type')

variable_by_name[variable_definition.name] = dict(
variables=[], variable_definition=variable_definition.id)
variable_by_name[variable_definition.name] = dict(variables=[],
variable_definition=variable_definition.id)

variables = self.collect_objects(data, get_content_type_id(Variable))

Expand Down
5 changes: 2 additions & 3 deletions business_logic/blockly/parse.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from lxml import etree, objectify
from io import StringIO

from django.utils.six import StringIO
from lxml import etree, objectify

from ..models import *
from ..utils import get_content_type_id
Expand Down
Loading

0 comments on commit ce13f33

Please sign in to comment.