misc: remove some warnings (#75590) #60
|
@ -15,9 +15,8 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from django.apps import apps
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.db import connection
|
||||
from django.db import connection, models
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
@ -26,7 +25,7 @@ class Command(BaseCommand):
|
|||
def handle(self, **options):
|
||||
for app in apps.get_models():
|
||||
for field in app._meta.get_fields():
|
||||
if isinstance(field, JSONField):
|
||||
if isinstance(field, models.JSONField):
|
||||
table_name = app._meta.db_table
|
||||
column_name = app._meta.get_field(field.name).column
|
||||
with connection.cursor() as cursor:
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -16,7 +15,7 @@ class Migration(migrations.Migration):
|
|||
'id',
|
||||
models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True),
|
||||
),
|
||||
('extra_data', JSONField(null=True)),
|
||||
('extra_data', models.JSONField(null=True)),
|
||||
('event', models.ForeignKey(to='agendas.Event', on_delete=models.CASCADE)),
|
||||
],
|
||||
options={},
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# Generated by Django 1.11.18 on 2020-08-11 14:11
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -21,7 +20,7 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
('timestamp', models.DateTimeField(auto_now_add=True)),
|
||||
('seen', models.BooleanField(default=False)),
|
||||
('booking_errors', JSONField(default=dict)),
|
||||
('booking_errors', models.JSONField(default=dict)),
|
||||
('bookings', models.ManyToManyField(to='agendas.Booking')),
|
||||
],
|
||||
options={
|
||||
|
|
|
@ -11,6 +11,6 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='booking',
|
||||
name='user_was_present',
|
||||
field=models.NullBooleanField(),
|
||||
field=models.BooleanField(null=True),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import django.contrib.postgres.fields.jsonb
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -12,7 +11,7 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='subscription',
|
||||
name='extra_data',
|
||||
field=django.contrib.postgres.fields.jsonb.JSONField(null=True),
|
||||
field=models.JSONField(null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='subscription',
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import django.contrib.postgres.fields.jsonb
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
@ -18,7 +17,7 @@ class Migration(migrations.Migration):
|
|||
),
|
||||
('slug', models.SlugField(max_length=160, unique=True, verbose_name='Identifier')),
|
||||
('label', models.CharField(max_length=150, verbose_name='Label')),
|
||||
('custom_fields', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list)),
|
||||
('custom_fields', models.JSONField(blank=True, default=list)),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import django.contrib.postgres.fields.jsonb
|
||||
from django.db import migrations
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -12,6 +11,6 @@ class Migration(migrations.Migration):
|
|||
migrations.AddField(
|
||||
model_name='event',
|
||||
name='custom_fields',
|
||||
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict),
|
||||
field=models.JSONField(blank=True, default=dict),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -33,7 +33,7 @@ from dateutil.rrule import DAILY, WEEKLY, rrule, rruleset
|
|||
from django.conf import settings
|
||||
from django.contrib.auth.models import Group
|
||||
from django.contrib.humanize.templatetags.humanize import ordinal
|
||||
from django.contrib.postgres.fields import ArrayField, JSONField
|
||||
from django.contrib.postgres.fields import ArrayField
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||
from django.db import connection, models, transaction
|
||||
|
@ -1507,7 +1507,7 @@ class Event(models.Model):
|
|||
meeting_type = models.ForeignKey(MeetingType, null=True, on_delete=models.CASCADE)
|
||||
desk = models.ForeignKey('Desk', null=True, on_delete=models.CASCADE)
|
||||
resources = models.ManyToManyField('Resource')
|
||||
custom_fields = JSONField(blank=True, default=dict)
|
||||
custom_fields = models.JSONField(blank=True, default=dict)
|
||||
|
||||
almost_full_notification_timestamp = models.DateTimeField(null=True, blank=True)
|
||||
full_notification_timestamp = models.DateTimeField(null=True, blank=True)
|
||||
|
@ -1706,13 +1706,13 @@ class Event(models.Model):
|
|||
Value('days'),
|
||||
'recurrence_days',
|
||||
function='jsonb_build_object',
|
||||
output_field=JSONField(),
|
||||
output_field=models.JSONField(),
|
||||
)
|
||||
|
||||
return qs.annotate(
|
||||
overlaps=ArraySubquery(
|
||||
overlapping_events.values(json=json_object),
|
||||
output_field=ArrayField(JSONField()),
|
||||
output_field=ArrayField(models.JSONField()),
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -2054,7 +2054,7 @@ class Event(models.Model):
|
|||
class EventsType(models.Model):
|
||||
slug = models.SlugField(_('Identifier'), max_length=160, unique=True)
|
||||
label = models.CharField(_('Label'), max_length=150)
|
||||
custom_fields = JSONField(blank=True, default=list)
|
||||
custom_fields = models.JSONField(blank=True, default=list)
|
||||
|
||||
def __str__(self):
|
||||
return self.label
|
||||
|
@ -2124,7 +2124,7 @@ class BookingColor(models.Model):
|
|||
|
||||
class Booking(models.Model):
|
||||
event = models.ForeignKey(Event, on_delete=models.CASCADE)
|
||||
extra_data = JSONField(null=True)
|
||||
extra_data = models.JSONField(null=True)
|
||||
anonymization_datetime = models.DateTimeField(null=True)
|
||||
cancellation_datetime = models.DateTimeField(null=True)
|
||||
email_reminder_datetime = models.DateTimeField(null=True)
|
||||
|
@ -2145,7 +2145,7 @@ class Booking(models.Model):
|
|||
user_first_name = models.CharField(max_length=250, blank=True)
|
||||
user_email = models.EmailField(blank=True)
|
||||
user_phone_number = models.CharField(max_length=30, blank=True)
|
||||
user_was_present = models.NullBooleanField()
|
||||
user_was_present = models.BooleanField(null=True)
|
||||
user_check_type_slug = models.CharField(max_length=160, blank=True, null=True)
|
||||
user_check_type_label = models.CharField(max_length=150, blank=True, null=True)
|
||||
out_of_min_delay = models.BooleanField(default=False)
|
||||
|
@ -3043,7 +3043,7 @@ class EventCancellationReport(models.Model):
|
|||
timestamp = models.DateTimeField(auto_now_add=True)
|
||||
seen = models.BooleanField(default=False)
|
||||
bookings = models.ManyToManyField(Booking)
|
||||
booking_errors = JSONField(default=dict)
|
||||
booking_errors = models.JSONField(default=dict)
|
||||
|
||||
def __str__(self):
|
||||
return '%s - %s' % (self.timestamp.strftime('%Y-%m-%d %H:%M:%S'), self.event)
|
||||
|
@ -3287,7 +3287,7 @@ class Subscription(models.Model):
|
|||
user_first_name = models.CharField(max_length=250)
|
||||
user_email = models.EmailField(blank=True)
|
||||
user_phone_number = models.CharField(max_length=30, blank=True)
|
||||
extra_data = JSONField(null=True)
|
||||
extra_data = models.JSONField(null=True)
|
||||
date_start = models.DateField()
|
||||
date_end = models.DateField()
|
||||
|
||||
|
|
|
@ -87,6 +87,8 @@ DATABASES = {
|
|||
}
|
||||
}
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/1.7/topics/i18n/
|
||||
|
||||
|
|
Loading…
Reference in New Issue