-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
85 changed files
with
927 additions
and
3,369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import datetime as dt | ||
|
||
from django.http import HttpRequest | ||
|
||
|
||
def global_data(request: HttpRequest) -> dict[str, dict[str, str]]: | ||
start_year = 2011 | ||
start_python = 2014 | ||
current_year = dt.datetime.now().year | ||
data = { | ||
"linkedin": "https://www.linkedin.com/in/eduzen/", | ||
"github": "https://github.com/eduzen", | ||
"email": "mailto:me@eduzen.com.ar", | ||
"telegram": "https://t.me/eduzen", | ||
"years_in_python": current_year - start_python, | ||
"years_of_experience": current_year - start_year, | ||
} | ||
return {"global_data": data} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import django_filters | ||
from django.contrib.postgres.search import SearchVector | ||
from django.db.models import QuerySet | ||
|
||
from blog.models import Post | ||
|
||
|
||
class PostFilter(django_filters.FilterSet): | ||
q = django_filters.CharFilter(method="filter_search", label="Search") | ||
|
||
class Meta: | ||
model = Post | ||
fields = [] | ||
|
||
def filter_search(self, queryset: QuerySet[Post], name: str, value: str) -> QuerySet[Post]: | ||
search_vector = SearchVector("text", "title", "pompadour") | ||
return queryset.annotate(search=search_vector).filter(search=value) |
Oops, something went wrong.