Skip to content

Commit

Permalink
merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Esteves committed Sep 11, 2018
2 parents 3451360 + 54cb131 commit c3353bc
Show file tree
Hide file tree
Showing 49 changed files with 1,581 additions and 1,287 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.svg binary
arctic/static/arctic/dist/** binary
arctic/static/arctic/dist/** linguist-vendored
CHANGELOG.md merge=union
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

Always reference the ticket number at the end of the issue description.


## [unreleased]

### Added
- blackened code
- added black check into CI

### Fixed
- field_label: changed 'optional' suffix rendering condition for disabled=False [#310][310]

[310]: //github.com/sanoma/django-arctic/issues/310


## 1.3.3

### Changed
- Changed slugify function

### Breaking
- Previous slugify ignored characters with accents (é á etc...)
This can affect existing slug depending on how the project is setup


## 1.3.3

### Changed
Expand Down
2 changes: 1 addition & 1 deletion arctic/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
default_app_config = 'arctic.apps.ArcticConfig'
default_app_config = "arctic.apps.ArcticConfig"
3 changes: 2 additions & 1 deletion arctic/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@


class ArcticConfig(AppConfig):
name = 'arctic'
name = "arctic"

# even though db usage in AppConfig is not a recommended best practice
# according to the Django docs, this is the best location to sync the
# roles defined in settings.ARCTIC_ROLES to the database.
def ready(self):
from .mixins import RoleAuthentication

try:
RoleAuthentication.sync()
except ImproperlyConfigured:
Expand Down
65 changes: 36 additions & 29 deletions arctic/bin/arctic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
def create_project(parser, options, args):
# Validate args
if len(args) < 2:
parser.error('Please specify a name for your Arctic installation')
parser.error("Please specify a name for your Arctic installation")
elif len(args) > 3:
parser.error('Too many arguments')
parser.error("Too many arguments")

project_name = args[1]
try:
dest_dir = args[2]
except IndexError:
dest_dir = ''
dest_dir = ""

# Make sure given name is not already in use by another
# python package/module.
Expand All @@ -28,25 +28,30 @@ def create_project(parser, options, args):
except ImportError:
pass
else:
parser.error('"{}" conflicts with the name of an existing '
'Python module and cannot be used as a project '
'name. Please try another name.'.format(project_name))
parser.error(
'"{}" conflicts with the name of an existing '
"Python module and cannot be used as a project "
"name. Please try another name.".format(project_name)
)

print('Creating an Arctic project named {}'.format(project_name))
print("Creating an Arctic project named {}".format(project_name))

# Create the project from the Arctic template using startapp

# First find the path to Arctic
import arctic

arctic_path = os.path.dirname(arctic.__file__)
template_path = os.path.join(arctic_path, 'project_template')
template_path = os.path.join(arctic_path, "project_template")

# Call django-admin startproject
utility_args = ['django-admin.py',
'startproject',
'--template=' + template_path,
'--ext=html,rst',
project_name]
utility_args = [
"django-admin.py",
"startproject",
"--template=" + template_path,
"--ext=html,rst",
project_name,
]

if dest_dir:
utility_args.append(dest_dir)
Expand All @@ -55,28 +60,30 @@ def create_project(parser, options, args):
utility.execute()

# add execute permission to manage.py, somehow it gets lost on the way
manage_py = os.path.join(dest_dir or project_name, 'manage.py')
manage_py = os.path.join(dest_dir or project_name, "manage.py")
st = os.stat(manage_py)
os.chmod(manage_py,
st.st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
os.chmod(
manage_py, st.st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
)

print('Congratulations! {0} has been created.\n'
'The next steps are:\n'
'- In config/settings.py change the database settings (if needed).\n'
'- Run database migrations: {0}/manage.py migrate.\n'
'- Create an admin user: {0}/manage.py createsuperuser.\n'
'- Finally run the project: {0}/manage.py runserver.\n'
.format(project_name))
print(
"Congratulations! {0} has been created.\n"
"The next steps are:\n"
"- In config/settings.py change the database settings (if needed).\n"
"- Run database migrations: {0}/manage.py migrate.\n"
"- Create an admin user: {0}/manage.py createsuperuser.\n"
"- Finally run the project: {0}/manage.py runserver.\n".format(
project_name
)
)


COMMANDS = {
'start': create_project,
}
COMMANDS = {"start": create_project}


def main():
# Parse options
parser = OptionParser(usage='Usage: arctic start project_name [directory]')
parser = OptionParser(usage="Usage: arctic start project_name [directory]")
(options, args) = parser.parse_args()

# Find command
Expand All @@ -89,8 +96,8 @@ def main():
if command in COMMANDS:
COMMANDS[command](parser, options, args)
else:
parser.error('Unrecognised command: ' + command)
parser.error("Unrecognised command: " + command)


if __name__ == '__main__':
if __name__ == "__main__":
main()
30 changes: 13 additions & 17 deletions arctic/defaults.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
# options are 'float-label', 'stacked' or 'tabular'
ARCTIC_FORM_DISPLAY = 'float-label'
ARCTIC_FORM_DISPLAY = "float-label"

ARCTIC_SITE_LOGO = 'arctic/dist/assets/img/arctic_logo.svg'
ARCTIC_SITE_LOGO = "arctic/dist/assets/img/arctic_logo.svg"

ARCTIC_SITE_NAME = 'Arctic Site Name'
ARCTIC_SITE_NAME = "Arctic Site Name"

ARCTIC_WIDGET_OVERLOADS = {
'DateInput': 'arctic.widgets.DatePickerInput',
'DateTimeInput': 'arctic.widgets.DateTimePickerInput',
'ClearableFileInput': 'arctic.widgets.BetterFileInput',
'FileInput': 'arctic.widgets.BetterFileInput',
'TimeInput': 'arctic.widgets.TimePickerInput',
'Select': 'arctic.widgets.StyledSelect',
'SelectMultiple': 'arctic.widgets.SelectizeMultiple',
'MultipleChoiceField': 'arctic.widgets.Selectize',
"DateInput": "arctic.widgets.DatePickerInput",
"DateTimeInput": "arctic.widgets.DateTimePickerInput",
"ClearableFileInput": "arctic.widgets.BetterFileInput",
"FileInput": "arctic.widgets.BetterFileInput",
"TimeInput": "arctic.widgets.TimePickerInput",
"Select": "arctic.widgets.StyledSelect",
"SelectMultiple": "arctic.widgets.SelectizeMultiple",
"MultipleChoiceField": "arctic.widgets.Selectize",
}

ARCTIC_PAGINATION = {
'show_label': True,
'show_first_last': True,
'range': 5,
}
ARCTIC_PAGINATION = {"show_label": True, "show_first_last": True, "range": 5}

ARCTIC_PAGINATION_TEMPLATE = 'arctic/partials/pagination.html'
ARCTIC_PAGINATION_TEMPLATE = "arctic/partials/pagination.html"
4 changes: 2 additions & 2 deletions arctic/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ def __init__(self, search_fields=[], *args, **kwargs):
self.search_fields = search_fields

def get_search_filter(self):
value = self.data.get('search')
value = self.data.get("search")
if not value:
return Q()

q_list = []
for field_name in self.search_fields:
q_list.append(Q(**{field_name + '__icontains': value}))
q_list.append(Q(**{field_name + "__icontains": value}))

return reduce(operator.or_, q_list)

0 comments on commit c3353bc

Please sign in to comment.