-
Notifications
You must be signed in to change notification settings - Fork 1
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
29 changed files
with
689 additions
and
116 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
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
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
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 |
---|---|---|
@@ -1,8 +1,15 @@ | ||
from django.contrib import admin | ||
|
||
from admin_extra_buttons.decorators import button | ||
|
||
from ..models import SyncLog | ||
from .base import BaseModelAdmin | ||
|
||
|
||
@admin.register(SyncLog) | ||
class SyncLogAdmin(admin.ModelAdmin): | ||
class SyncLogAdmin(BaseModelAdmin): | ||
list_display = ("content_type", "content_object", "last_update_date", "last_id") | ||
|
||
@button() | ||
def sync_all(self, request): | ||
SyncLog.objects.refresh() |
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
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
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
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
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,34 @@ | ||
from django import forms | ||
from django.conf import settings | ||
from django.utils.text import slugify | ||
|
||
from hope_flex_fields.models import FieldDefinition | ||
|
||
from country_workspace.models import SyncLog | ||
|
||
|
||
def create_hope_field_definitions(): | ||
for m in settings.HH_LOOKUPS: | ||
n = f"HOPE HH {m}" | ||
FieldDefinition.objects.get_or_create(name=n, slug=slugify(n), field_type=forms.ChoiceField) | ||
for m in settings.IND_LOOKUPS: | ||
n = f"HOPE IND {m}" | ||
FieldDefinition.objects.get_or_create(name=n, slug=slugify(n), field_type=forms.ChoiceField) | ||
FieldDefinition.objects.get_or_create( | ||
name="HOPE IND Gender", | ||
slug=slugify("HOPE IND Gender"), | ||
attrs={"choices": [["FEMALE", "FEMALE"], ["MALE", "MALE"], ["UNKNOWN", "UNKNOWN"]]}, | ||
field_type=forms.ChoiceField, | ||
) | ||
FieldDefinition.objects.get_or_create( | ||
name="HOPE IND Disability", | ||
slug=slugify("HOPE IND Disability"), | ||
field_type=forms.ChoiceField, | ||
attrs={"choices": [["not disabled", "not disabled"], ["disabled", "disabled"]]}, | ||
) | ||
|
||
SyncLog.objects.create_lookups() | ||
|
||
|
||
def removes_hope_field_definitions(): | ||
FieldDefinition.objects.filter(name__startswith="HOPE ").delete() |
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
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,7 @@ | ||
from country_workspace.versioning.hope_fields import create_hope_field_definitions, removes_hope_field_definitions | ||
|
||
|
||
class Scripts: | ||
operations = [ | ||
(create_hope_field_definitions, removes_hope_field_definitions), | ||
] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.