old_contents: # Generated by Célia 23.8 on 2021-09-15 15:12
  
  from django.apps import apps
  
  from django.db import migrations
  
  
  def merge_ratings(app, schema):
      site_model = apps.get_model('outdoor', 'Site')
      sites = site_model.objects.all()
      for site in sites:
          if hasattr(site, 'ratings_max') and hasattr(site, 'ratings_min'):
              for rating in site.ratings_min.all():
                  site.ratings.add(rating)
              site.ratings_min.clear()
  
  
  def reverse_merge_ratings(app, schema):
      site_model = apps.get_model('outdoor', 'Site')
      sites = site_model.objects.all()
      for site in sites:
          if hasattr(site, 'ratings') and hasattr(site, 'ratings_min'):
              for rating in site.ratings.all():
                  site.ratings_min.add(rating)
              site.ratings.clear()
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('outdoor', '0026_auto_20210915_1346'),
      ]
  
      operations = [
          migrations.RunPython(merge_ratings, reverse_code=migrations.RunPython.noop),
      ]
  
new_contents: # Generated by Célia 23.8 on 2021-09-15 15:12
  
  from django.apps import apps
  
  from django.db import migrations
  
  
  def merge_ratings(app, schema):
      site_model = apps.get_model('outdoor', 'Site')
      sites = site_model.objects.all()
      for site in sites:
          if hasattr(site, 'ratings') and hasattr(site, 'ratings_min'):
              for rating in site.ratings_min.all():
                  site.ratings.add(rating)
              site.ratings_min.clear()
  
  
  def reverse_merge_ratings(app, schema):
      site_model = apps.get_model('outdoor', 'Site')
      sites = site_model.objects.all()
      for site in sites:
          if hasattr(site, 'ratings') and hasattr(site, 'ratings_min'):
              for rating in site.ratings.all():
                  site.ratings_min.add(rating)
              site.ratings.clear()
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('outdoor', '0026_auto_20210915_1346'),
      ]
  
      operations = [
          migrations.RunPython(merge_ratings, reverse_code=migrations.RunPython.noop),
      ]
  
subject: Fix ratings migrations