-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4576 from korycins/dynamic_settings_for_plugins
Add dynamic settings api for plugins
- Loading branch information
Showing
26 changed files
with
1,299 additions
and
107 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
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,43 @@ | ||
# Generated by Django 2.2.3 on 2019-08-07 10:11 | ||
|
||
import django.contrib.postgres.fields.jsonb | ||
from django.db import migrations, models | ||
|
||
import saleor.core.utils.json_serializer | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="PluginConfiguration", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("name", models.CharField(max_length=128, unique=True)), | ||
("description", models.TextField(blank=True)), | ||
("active", models.BooleanField(default=True)), | ||
( | ||
"configuration", | ||
django.contrib.postgres.fields.jsonb.JSONField( | ||
blank=True, | ||
default=dict, | ||
encoder=saleor.core.utils.json_serializer.CustomJsonEncoder, | ||
null=True, | ||
), | ||
), | ||
], | ||
options={"permissions": (("manage_plugins", "Manage plugins"),)}, | ||
) | ||
] |
Empty file.
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,22 @@ | ||
from django.contrib.postgres.fields import JSONField | ||
from django.db import models | ||
from django.utils.translation import pgettext_lazy | ||
|
||
from saleor.core.utils.json_serializer import CustomJsonEncoder | ||
|
||
|
||
class PluginConfiguration(models.Model): | ||
name = models.CharField(max_length=128, unique=True) | ||
description = models.TextField(blank=True) | ||
active = models.BooleanField(default=True) | ||
configuration = JSONField( | ||
blank=True, null=True, default=dict, encoder=CustomJsonEncoder | ||
) | ||
|
||
class Meta: | ||
permissions = ( | ||
("manage_plugins", pgettext_lazy("Plugin description", "Manage plugins")), | ||
) | ||
|
||
def __str__(self): | ||
return f"Configuration of {self.name}, active: {self.active}" |
Oops, something went wrong.