Sort by date

Display Projects sorted by creation date
This commit is contained in:
Kristofers Solo 2023-06-30 10:34:25 +03:00
parent 63d4eb4478
commit 9dfd78b322
2 changed files with 31 additions and 28 deletions

View File

@ -44,7 +44,7 @@ class ProfileProjectListView(ListView):
def get_queryset(self): def get_queryset(self):
username = self.kwargs.get("username") username = self.kwargs.get("username")
self.user = get_object_or_404(get_user_model(), username=username) self.user = get_object_or_404(get_user_model(), username=username)
return Project.objects.filter(owner__username=username) return Project.objects.filter(owner__username=username).order_by("-date_created")
def get_context_data(self, *args, **kwargs): def get_context_data(self, *args, **kwargs):
data = super().get_context_data(**kwargs) data = super().get_context_data(**kwargs)
@ -59,6 +59,9 @@ class ProjectListView(ListView):
context_object_name = "projects" context_object_name = "projects"
paginate_by = 50 # amount of items on screen paginate_by = 50 # amount of items on screen
def get_queryset(self):
return Project.objects.order_by('-date_created')
def get_context_data(self, *args, **kwargs): def get_context_data(self, *args, **kwargs):
data = super().get_context_data(**kwargs) data = super().get_context_data(**kwargs)
data["title"] = "FOSSDB | Explore" data["title"] = "FOSSDB | Explore"

View File

@ -1,29 +1,29 @@
{ {
"name": "tokyonight_night", "name": "tokyonight_night",
"version": "3.6.0", "version": "3.6.0",
"description": "", "description": "",
"scripts": { "scripts": {
"start": "npm run dev", "start": "npm run dev",
"build": "npm run build:clean && npm run build:tailwind", "build": "npm run build:clean && npm run build:tailwind",
"build:clean": "rimraf ../static/css/dist", "build:clean": "rimraf ../static/css/dist",
"build:tailwind": "cross-env NODE_ENV=production tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css --minify", "build:tailwind": "cross-env NODE_ENV=production tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css --minify",
"dev": "cross-env NODE_ENV=development tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css -w", "dev": "cross-env NODE_ENV=development tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css -w",
"tailwindcss": "node ./node_modules/tailwindcss/lib/cli.js" "tailwindcss": "node ./node_modules/tailwindcss/lib/cli.js"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@tailwindcss/aspect-ratio": "^0.4.2", "@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.3", "@tailwindcss/forms": "^0.5.3",
"@tailwindcss/line-clamp": "^0.4.4", "@tailwindcss/line-clamp": "^0.4.4",
"@tailwindcss/typography": "^0.5.9", "@tailwindcss/typography": "^0.5.9",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"postcss": "^8.4.24", "postcss": "^8.4.24",
"postcss-import": "^15.1.0", "postcss-import": "^15.1.0",
"postcss-nested": "^6.0.1", "postcss-nested": "^6.0.1",
"postcss-simple-vars": "^7.0.1", "postcss-simple-vars": "^7.0.1",
"rimraf": "^5.0.1", "rimraf": "^5.0.1",
"tailwindcss": "^3.3.2" "tailwindcss": "^3.3.2"
} }
} }