Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internationalization base #1246

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions web/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ def get_most_recent_scan(self, obj):
return obj.get_recent_scan_id()

def get_insert_date(self, obj):
return naturalday(obj.insert_date).title()
return naturalday(obj.insert_date)

def get_insert_date_humanized(self, obj):
return naturaltime(obj.insert_date).title()
return naturaltime(obj.insert_date)

def get_start_scan_date(self, obj):
if obj.start_scan_date:
return naturalday(obj.start_scan_date).title()
return naturalday(obj.start_scan_date)

def get_start_scan_date_humanized(self, obj):
if obj.start_scan_date:
return naturaltime(obj.start_scan_date).title()
return naturaltime(obj.start_scan_date)


class SubScanResultSerializer(serializers.ModelSerializer):
Expand Down
13 changes: 13 additions & 0 deletions web/celery-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#!/bin/bash

python3 manage.py makemigrations

# Hotfix for missing users migration due to swap mid-project
# Assumes PostgreSQL is the db used

apt-get install -y postgresql-client
echo "INSERT INTO django_migrations (app, name, applied) SELECT 'users', '0001_initial', CURRENT_TIMESTAMP WHERE NOT EXISTS (SELECT app FROM django_migrations WHERE app = 'users' AND name = '0001_initial');" | python3 manage.py dbshell
echo "UPDATE django_content_type SET app_label = 'users' WHERE app_label = 'auth' and model = 'user';" | python3 manage.py dbshell

python3 manage.py migrate
python3 manage.py collectstatic --no-input --clear

Expand All @@ -21,6 +29,10 @@ Pin-Priority: -1
' | tee /etc/apt/preferences.d/mozilla-firefox
apt update
apt install firefox -y
apt install -y gettext

find . -type f -name "*.po" -exec sed -i 's/^#~ //g' {} +
python3 manage.py compilemessages

# Temporary fix for whatportis bug - See https://github.com/yogeshojha/rengine/issues/984
sed -i 's/purge()/truncate()/g' /usr/local/lib/python3.10/dist-packages/whatportis/cli.py
Expand Down Expand Up @@ -162,6 +174,7 @@ exec "$@"
# httpx seems to have issue, use alias instead!!!
echo 'alias httpx="/go/bin/httpx"' >> ~/.bashrc

pip uninstall -y httpcore

# watchmedo auto-restart --recursive --pattern="*.py" --directory="/usr/src/app/reNgine/" -- celery -A reNgine.tasks worker --autoscale=10,0 -l INFO -Q scan_queue &
echo "Starting Workers..."
Expand Down
8 changes: 8 additions & 0 deletions web/dashboard/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.forms import ModelForm
from users.models import User


class UserSettingsForm(ModelForm):
class Meta:
model = User
fields = ["language"]
Binary file added web/dashboard/locale/en/LC_MESSAGES/django.mo
Binary file not shown.
Loading