fix articles ordering on index
This commit is contained in:
parent
0b5362b143
commit
33b2983602
108
.github/workflows/build.yaml
vendored
108
.github/workflows/build.yaml
vendored
@ -1,108 +0,0 @@
|
||||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
redis:
|
||||
image: redis
|
||||
ports:
|
||||
- 6379/tcp
|
||||
options: --entrypoint redis-server
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- 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 -r requirements.txt
|
||||
pip install coverage coveralls
|
||||
|
||||
- name: Run Tests
|
||||
env:
|
||||
REDIS_URL: redis://redis:${{ job.services.redis.ports[6379] }}/0
|
||||
run: |
|
||||
python manage.py collectstatic --noinput
|
||||
python manage.py migrate --noinput
|
||||
python manage.py test --noinput
|
||||
|
||||
- name: Run codecov
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
file: ./coverage.xml
|
||||
flags: unittests
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: true
|
||||
|
||||
- name: Coveralls GitHub Action
|
||||
uses: coverallsapp/github-action@1.1.3
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [tests]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata for the Docker image
|
||||
id: meta
|
||||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
||||
with:
|
||||
images: dntskdev/later42
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build]
|
||||
steps:
|
||||
- name: Deploy
|
||||
run: |-
|
||||
mkdir -p /home/runner/.ssh
|
||||
echo "$SSH_KEY" > /home/runner/.ssh/id_rsa
|
||||
chmod 600 /home/runner/.ssh/id_rsa
|
||||
cat >> /home/runner/.ssh/config <<END
|
||||
Host cloud
|
||||
HostName $SSH_HOST
|
||||
User $SSH_USER
|
||||
IdentityFile /home/runner/.ssh/id_rsa
|
||||
StrictHostKeyChecking no
|
||||
UserKnownHostsFile /dev/null
|
||||
END
|
||||
ssh cloud 'docker-compose -f /opt/docker-compose.yaml pull later42 later42_tasks'
|
||||
ssh cloud 'docker-compose -f /opt/docker-compose.yaml up -d later42 later42_tasks'
|
||||
rm -rf /home/runner/.ssh
|
||||
env:
|
||||
SSH_KEY: ${{ secrets.SSH_KEY }}
|
||||
SSH_HOST: ${{ secrets.SSH_HOST }}
|
||||
SSH_USER: ${{ secrets.SSH_USER }}
|
@ -13,7 +13,8 @@ def get(request):
|
||||
try:
|
||||
urls = URL.objects.filter(
|
||||
user=request.user, archived=False).order_by('-id')
|
||||
data = Article.objects.filter(url__in=urls).select_related('url')
|
||||
data = Article.objects.filter(
|
||||
url__in=urls).select_related('url').order_by('-id')
|
||||
except:
|
||||
urls = []
|
||||
context = {'data': data}
|
||||
@ -28,7 +29,8 @@ def archive(request, url_id=None):
|
||||
try:
|
||||
urls = URL.objects.filter(
|
||||
user=request.user, archived=True).order_by('-id')
|
||||
data = Article.objects.filter(url__in=urls).select_related('url').order_by('-id')
|
||||
data = Article.objects.filter(
|
||||
url__in=urls).select_related('url').order_by('-id')
|
||||
paginator = Paginator(data, settings.URLS_PER_PAGE)
|
||||
page_number = request.GET.get('page')
|
||||
data = paginator.get_page(page_number)
|
||||
|
Loading…
Reference in New Issue
Block a user