Skip to content

move 'update_scores' to a management command

Lars Kruse requested to merge update-scores-command into master

Um die Scores per Cron-Job zu aktualisieren, wollen wir sie als "management command" verfügbar machen.

Leider schlägt dies aktuell noch fehl (zumindest in meiner lokalen Instanz). Mag es mal einer von euch ausprobieren? Oder gab es vielleicht eine Änderung rund um Group und ihre Methode get_content_type?

(stadtgestalten) lars@erker:~/git/stadtgestalten$ python manage.py update_scores
System check identified some issues:

WARNINGS:
?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_DEBUG.
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/lars/.virtualenvs/stadtgestalten/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/home/lars/.virtualenvs/stadtgestalten/lib/python3.5/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/lars/.virtualenvs/stadtgestalten/lib/python3.5/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/lars/.virtualenvs/stadtgestalten/lib/python3.5/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/home/lars/git/stadtgestalten/utils/management/commands/update_scores.py", line 12, in handle
    core.scores.update(features.groups.models.Group)
  File "/home/lars/git/stadtgestalten/core/scores.py", line 13, in update
    instance.score += p.score(instance)
  File "/home/lars/git/stadtgestalten/features/stadt/scores.py", line 42, in score
    content__associations__entity_type=instance.get_content_type(),
AttributeError: 'Group' object has no attribute 'get_content_type'

Merge request reports