
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('extras', '0021_add_color_comments_changelog_to_tag'),
    ]

    operations = [
        migrations.CreateModel(
            name='CustomLink',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=100, unique=True)),
                ('text', models.CharField(max_length=200)),
                ('url', models.CharField(max_length=200)),
                ('weight', models.PositiveSmallIntegerField(default=100)),
                ('group_name', models.CharField(blank=True, max_length=50)),
                ('button_class', models.CharField(default='default', max_length=30)),
                ('new_window', models.BooleanField()),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
            ],
            options={
                'ordering': ['group_name', 'weight', 'name'],
            },
        ),
    ]


from django.db import migrations, models
import django.db.models.deletion
import extras.models


class Migration(migrations.Migration):

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('extras', '0021_add_color_comments_changelog_to_tag'),
    ]

    operations = [
        migrations.CreateModel(
            name='CustomLink',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=100, unique=True)),
                ('text', models.CharField(max_length=200)),
                ('url', models.CharField(max_length=200)),
                ('weight', models.PositiveSmallIntegerField(default=100)),
                ('group_name', models.CharField(blank=True, max_length=50)),
                ('button_class', models.CharField(default='default', max_length=30)),
                ('new_window', models.BooleanField()),
                ('content_type', models.ForeignKey(limit_choices_to=extras.models.get_custom_link_models, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
            ],
            options={
                'ordering': ['group_name', 'weight', 'name'],
            },
        ),
    ]

Add limit_choices_to to CustomLink.content_type field
Add limit_choices_to to CustomLink.content_type field

  
  from django.db import migrations, models
  import django.db.models.deletion
+ import extras.models
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('contenttypes', '0002_remove_content_type_name'),
          ('extras', '0021_add_color_comments_changelog_to_tag'),
      ]
  
      operations = [
          migrations.CreateModel(
              name='CustomLink',
              fields=[
                  ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False)),
                  ('name', models.CharField(max_length=100, unique=True)),
                  ('text', models.CharField(max_length=200)),
                  ('url', models.CharField(max_length=200)),
                  ('weight', models.PositiveSmallIntegerField(default=100)),
                  ('group_name', models.CharField(blank=True, max_length=50)),
                  ('button_class', models.CharField(default='default', max_length=30)),
                  ('new_window', models.BooleanField()),
-                 ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
+                 ('content_type', models.ForeignKey(limit_choices_to=extras.models.get_custom_link_models, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
              ],
              options={
                  'ordering': ['group_name', 'weight', 'name'],
              },
          ),
      ]
  
Add limit_choices_to to CustomLink.content_type field
## Code Before:

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('extras', '0021_add_color_comments_changelog_to_tag'),
    ]

    operations = [
        migrations.CreateModel(
            name='CustomLink',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=100, unique=True)),
                ('text', models.CharField(max_length=200)),
                ('url', models.CharField(max_length=200)),
                ('weight', models.PositiveSmallIntegerField(default=100)),
                ('group_name', models.CharField(blank=True, max_length=50)),
                ('button_class', models.CharField(default='default', max_length=30)),
                ('new_window', models.BooleanField()),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
            ],
            options={
                'ordering': ['group_name', 'weight', 'name'],
            },
        ),
    ]

## Instruction:
Add limit_choices_to to CustomLink.content_type field
## Code After:

from django.db import migrations, models
import django.db.models.deletion
import extras.models


class Migration(migrations.Migration):

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('extras', '0021_add_color_comments_changelog_to_tag'),
    ]

    operations = [
        migrations.CreateModel(
            name='CustomLink',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=100, unique=True)),
                ('text', models.CharField(max_length=200)),
                ('url', models.CharField(max_length=200)),
                ('weight', models.PositiveSmallIntegerField(default=100)),
                ('group_name', models.CharField(blank=True, max_length=50)),
                ('button_class', models.CharField(default='default', max_length=30)),
                ('new_window', models.BooleanField()),
                ('content_type', models.ForeignKey(limit_choices_to=extras.models.get_custom_link_models, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
            ],
            options={
                'ordering': ['group_name', 'weight', 'name'],
            },
        ),
    ]
