12334-generic-products-name-in-invoice #18

Merged
mravi merged 5 commits from 12334-generic-products-name-in-invoice into master 2024-03-22 11:25:49 +00:00
7 changed files with 73 additions and 5 deletions
Showing only changes of commit 0679a47eea - Show all commits

View file

@ -1 +1,2 @@
.git .git
.env

View file

@ -1,4 +1,5 @@
FROM python:3.10.0-alpine3.15 # FROM python:3.10.0-alpine3.15
FROM python:3.5-alpine3.12
WORKDIR /usr/src/app WORKDIR /usr/src/app
@ -7,12 +8,25 @@ RUN apk add --update --no-cache \
build-base \ build-base \
openldap-dev \ openldap-dev \
python3-dev \ python3-dev \
libpq-dev \ postgresql-dev \
jpeg-dev \
libxml2-dev \
libxslt-dev \
libmemcached-dev \
zlib-dev \
&& rm -rf /var/cache/apk/* && rm -rf /var/cache/apk/*
## For alpine 3.15 replace postgresql-dev with libpq-dev
# FIX https://github.com/python-ldap/python-ldap/issues/432 # FIX https://github.com/python-ldap/python-ldap/issues/432
RUN echo 'INPUT ( libldap.so )' > /usr/lib/libldap_r.so RUN echo 'INPUT ( libldap.so )' > /usr/lib/libldap_r.so
COPY requirements.txt ./ COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Pillow seems to need LIBRARY_PATH set as follows: (see: https://github.com/python-pillow/Pillow/issues/1763#issuecomment-222383534)
RUN LIBRARY_PATH=/lib:/usr/lib /bin/sh -c "pip install --no-cache-dir -r requirements.txt"
COPY ./ . COPY ./ .
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh" ]

23
build-image.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/sh
if [ $# -lt 1 ]; then
echo "$0 imageversion [push]"
echo "Version could be: $(git describe --always)"
echo "If push is specified, also push to our harbor"
exit 1
fi
tagprefix=harbor.k8s.ungleich.ch/ungleich-public/dynamicweb
version=$1; shift
tag=${tagprefix}:${version}
set -ex
docker build -t "${tag}" .
push=$1; shift
if [ "$push" ]; then
docker push "${tag}"
fi

View file

@ -777,3 +777,9 @@ if DEBUG:
from .local import * # flake8: noqa from .local import * # flake8: noqa
else: else:
from .prod import * # flake8: noqa from .prod import * # flake8: noqa
# Try to load dynamic configuration, if it exists
try:
from .dynamic import * # flake8: noqa
except ImportError:
pass

19
entrypoint.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
set -uex
cd /usr/src/app/
cat > dynamicweb/settings/dynamic.py <<EOF
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': '${POSTGRES_DB}',
'USER': '${POSTGRES_USER}',
'PASSWORD': '${POSTGRES_PASSWORD}',
'HOST': '${POSTGRES_HOST}',
'PORT': '5432',
}
}
EOF
exec "$@"

View file

@ -1544,7 +1544,12 @@ class VirtualMachinesPlanListView(LoginRequiredMixin, ListView):
ordering = '-id' ordering = '-id'
def get_queryset(self): def get_queryset(self):
owner = self.request.user username = self.request.GET.get('username')
if self.request.user.is_admin and username:
user = CustomUser.objects.get(username=username)
else:
user = self.request.user
owner = user
manager = OpenNebulaManager(email=owner.username, manager = OpenNebulaManager(email=owner.username,
password=owner.password) password=owner.password)
try: try:

View file

@ -25,7 +25,7 @@ django-compressor==2.0
django-debug-toolbar==1.4 django-debug-toolbar==1.4
python-dotenv==0.10.3 python-dotenv==0.10.3
django-extensions==1.6.7 django-extensions==1.6.7
django-filer==2.1.2 django-filer==1.2.0
django-filter==0.13.0 django-filter==0.13.0
django-formtools==1.0 django-formtools==1.0
django-guardian==1.4.4 django-guardian==1.4.4