Skip to content
Snippets Groups Projects
Verified Commit f592ebdf authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Allow passing config dict to get_favicons

parent e6b4ce1f
No related branches found
No related tags found
1 merge request!1Resolve "Optimise query count"
...@@ -60,16 +60,19 @@ class Favicon(models.Model): ...@@ -60,16 +60,19 @@ class Favicon(models.Model):
verbose_name = 'Favicon' verbose_name = 'Favicon'
verbose_name_plural = 'Favicons' verbose_name_plural = 'Favicons'
def get_favicons(self, update=False): def get_favicons(self, update=False, config_override=None):
""" """
Get all combinations of favicons as configured, creating mising ones. Get all combinations of favicons as configured, creating mising ones.
Pass update=True to force re-generation of existing icons. Pass update=True to force re-generation of existing icons.
""" """
# Use default config by default
if config_override is None:
config_override = config
# Get all combinations of favicon rels and sizes from config # Get all combinations of favicon rels and sizes from config
query = Q() query = Q()
for rel in config: for rel in config_override:
for size in config[rel]: for size in config_override[rel]:
query |= Q(rel=rel, size=size) query |= Q(rel=rel, size=size)
# Get all existing favicons # Get all existing favicons
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment