Skip to content

Commit

Permalink
Replace deprecated django-update-from-dict package (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
Johnwz123 authored Sep 17, 2024
1 parent a35bd5e commit 55ae322
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 38 deletions.
1 change: 0 additions & 1 deletion backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ psycopg2-binary==2.9.1
python-dotenv==0.19.0
django-anymail[sendinblue]==8.4
djangorestframework-camel-case
django-update-from-dict
django-cors-headers
django-jazzmin
django[argon2]
Expand Down
3 changes: 1 addition & 2 deletions backend/treeckle/authentication/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

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


class Migration(migrations.Migration):
Expand All @@ -26,6 +25,6 @@ class Migration(migrations.Migration):
options={
'abstract': False,
},
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

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


class Migration(migrations.Migration):
Expand All @@ -25,6 +24,6 @@ class Migration(migrations.Migration):
options={
'abstract': False,
},
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

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


class Migration(migrations.Migration):
Expand Down Expand Up @@ -35,6 +34,6 @@ class Migration(migrations.Migration):
options={
'abstract': False,
},
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

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


class Migration(migrations.Migration):
Expand All @@ -25,6 +24,6 @@ class Migration(migrations.Migration):
options={
'abstract': False,
},
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
]
3 changes: 1 addition & 2 deletions backend/treeckle/bookings/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.expressions
import django_update_from_dict


class Migration(migrations.Migration):
Expand Down Expand Up @@ -32,7 +31,7 @@ class Migration(migrations.Migration):
options={
'ordering': ['-created_at'],
},
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
migrations.AddConstraint(
model_name='booking',
Expand Down
5 changes: 2 additions & 3 deletions backend/treeckle/comments/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

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


class Migration(migrations.Migration):
Expand All @@ -27,7 +26,7 @@ class Migration(migrations.Migration):
options={
'ordering': ['-created_at'],
},
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
migrations.CreateModel(
name='CommentRead',
Expand All @@ -38,7 +37,7 @@ class Migration(migrations.Migration):
('comment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='comments.comment')),
('reader', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.user')),
],
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
migrations.CreateModel(
name='BookingComment',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by Django 3.2.5 on 2021-07-28 07:56

from django.db import migrations, models
import django_update_from_dict


class Migration(migrations.Migration):
Expand All @@ -24,6 +23,6 @@ class Migration(migrations.Migration):
options={
'abstract': False,
},
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
]
11 changes: 5 additions & 6 deletions backend/treeckle/events/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django_update_from_dict


class Migration(migrations.Migration):
Expand Down Expand Up @@ -38,7 +37,7 @@ class Migration(migrations.Migration):
options={
'ordering': ['-created_at'],
},
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
migrations.CreateModel(
name='EventCategoryType',
Expand All @@ -52,7 +51,7 @@ class Migration(migrations.Migration):
options={
'ordering': ['name'],
},
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
migrations.CreateModel(
name='EventSignUp',
Expand All @@ -67,7 +66,7 @@ class Migration(migrations.Migration):
options={
'ordering': ['-status', 'created_at'],
},
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
migrations.CreateModel(
name='EventCategoryTypeSubscription',
Expand All @@ -78,7 +77,7 @@ class Migration(migrations.Migration):
('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='events.eventcategorytype')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='users.user')),
],
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
migrations.CreateModel(
name='EventCategory',
Expand All @@ -89,7 +88,7 @@ class Migration(migrations.Migration):
('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='events.eventcategorytype')),
('event', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='events.event')),
],
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
migrations.AddConstraint(
model_name='eventsignup',
Expand Down
3 changes: 1 addition & 2 deletions backend/treeckle/organizations/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by Django 3.1.3 on 2020-12-23 09:50

from django.db import migrations, models
import django_update_from_dict


class Migration(migrations.Migration):
Expand All @@ -23,6 +22,6 @@ class Migration(migrations.Migration):
options={
'ordering': ['name'],
},
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

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


class Migration(migrations.Migration):
Expand All @@ -25,7 +24,7 @@ class Migration(migrations.Migration):
options={
'ordering': ['name'],
},
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
migrations.AddConstraint(
model_name='organizationlistener',
Expand Down
11 changes: 6 additions & 5 deletions backend/treeckle/treeckle/common/models.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from django.db import models

from django_update_from_dict import UpdateFromDictMixin


class TimestampedModel(UpdateFromDictMixin, models.Model):
class TimestampedModel(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)

class Meta:
abstract = True
abstract = True

def update_from_dict(self, update_dict):
for field, value in update_dict.items():
setattr(self, field, value)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

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


class Migration(migrations.Migration):
Expand All @@ -24,6 +23,6 @@ class Migration(migrations.Migration):
options={
'abstract': False,
},
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
]
5 changes: 2 additions & 3 deletions backend/treeckle/venues/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

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


class Migration(migrations.Migration):
Expand All @@ -26,7 +25,7 @@ class Migration(migrations.Migration):
options={
'ordering': ['name'],
},
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
migrations.CreateModel(
name='Venue',
Expand All @@ -46,7 +45,7 @@ class Migration(migrations.Migration):
options={
'ordering': ['name'],
},
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
migrations.AddConstraint(
model_name='venuecategory',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

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


class Migration(migrations.Migration):
Expand All @@ -22,7 +21,7 @@ class Migration(migrations.Migration):
('email', models.EmailField(max_length=254)),
('venue', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='venues.venue')),
],
bases=(django_update_from_dict.UpdateFromDictMixin, models.Model),
bases=(models.Model,),
),
migrations.AddConstraint(
model_name='venuebookingnotificationsubscription',
Expand Down

0 comments on commit 55ae322

Please sign in to comment.