Skip to content

Commit

Permalink
don't fetch data from database in a loop if they are global to the lo…
Browse files Browse the repository at this point in the history
…op context
  • Loading branch information
amirouche committed Jul 17, 2012
1 parent 9efd071 commit afd185b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions admincommand/management.py
Expand Up @@ -20,12 +20,12 @@ def sync_db_callback(verbosity=0, interactive=False, signal=None, **kwargs):
import_module(admin_commands_path)
except ImportError:
pass
ct = ContentType.objects.get(
model='admincommand',
app_label='admincommand',
)
for subclass in admincommand.models.AdminCommand.__subclasses__():
codename = subclass.permission_codename()
ct = ContentType.objects.get(
model='admincommand',
app_label='admincommand',
)
perm, created = Permission.objects.get_or_create(
codename=codename,
content_type=ct,
Expand Down

0 comments on commit afd185b

Please sign in to comment.