Skip to content

Commit 2b93fa4

Browse files
daliborpavlovicjspetrak
authored andcommitted
Remove jsonfield
1 parent d37ccb5 commit 2b93fa4

File tree

16 files changed

+29
-58
lines changed

16 files changed

+29
-58
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ENV PYTHONUNBUFFERED 1
33

44
RUN apt-get update
55
RUN apt-get install -y binutils libproj-dev gdal-bin postgresql-client
6-
RUN pip install "django>=2.0,<=2.2" "psycopg2==2.8.6"
6+
RUN pip install "django>=2.2" "psycopg2"
77

88
RUN mkdir /code
99
RUN mkdir /feeds

multigtfs/migrations/0001_initial.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from __future__ import unicode_literals
44

55
from django.db import models, migrations
6-
import jsonfield.fields
76
import django.contrib.gis.db.models.fields
87
import multigtfs.models.fields.seconds
98

@@ -25,7 +24,7 @@ class Migration(migrations.Migration):
2524
('lang', models.CharField(help_text='ISO 639-1 code for the primary language', max_length=2, blank=True)),
2625
('phone', models.CharField(help_text='Voice telephone number', max_length=255, blank=True)),
2726
('fare_url', models.URLField(help_text='URL for purchasing tickets online', blank=True)),
28-
('extra_data', jsonfield.fields.JSONField(default={}, null=True, blank=True)),
27+
('extra_data', models.JSONField(default={}, null=True, blank=True)),
2928
],
3029
options={
3130
'db_table': 'agency',
@@ -54,7 +53,7 @@ class Migration(migrations.Migration):
5453
('payment_method', models.IntegerField(default=1, help_text='When is the fare paid?', choices=[(0, 'Fare is paid on board.'), (1, 'Fare must be paid before boarding.')])),
5554
('transfers', models.IntegerField(default=None, help_text='Are transfers permitted?', null=True, blank=True, choices=[(0, 'No transfers permitted on this fare.'), (1, 'Passenger may transfer once.'), (2, 'Passenger may transfer twice.'), (None, 'Unlimited transfers are permitted.')])),
5655
('transfer_duration', models.IntegerField(help_text='Time in seconds until a ticket or transfer expires', null=True, blank=True)),
57-
('extra_data', jsonfield.fields.JSONField(default={}, null=True, blank=True)),
56+
('extra_data', models.JSONField(default={}, null=True, blank=True)),
5857
],
5958
options={
6059
'db_table': 'fare',
@@ -65,7 +64,7 @@ class Migration(migrations.Migration):
6564
name='FareRule',
6665
fields=[
6766
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
68-
('extra_data', jsonfield.fields.JSONField(default={}, null=True, blank=True)),
67+
('extra_data', models.JSONField(default={}, null=True, blank=True)),
6968
],
7069
options={
7170
'db_table': 'fare_rules',
@@ -78,7 +77,7 @@ class Migration(migrations.Migration):
7877
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
7978
('name', models.CharField(max_length=255)),
8079
('created', models.DateTimeField(auto_now_add=True)),
81-
('meta', jsonfield.fields.JSONField(default={}, null=True, blank=True)),
80+
('meta', models.JSONField(default={}, null=True, blank=True)),
8281
],
8382
options={
8483
'db_table': 'feed',
@@ -95,7 +94,7 @@ class Migration(migrations.Migration):
9594
('start_date', models.DateField(help_text='Date that feed starts providing reliable data.', null=True, blank=True)),
9695
('end_date', models.DateField(help_text='Date that feed stops providing reliable data.', null=True, blank=True)),
9796
('version', models.CharField(help_text='Version of feed.', max_length=255, blank=True)),
98-
('extra_data', jsonfield.fields.JSONField(default={}, null=True, blank=True)),
97+
('extra_data', models.JSONField(default={}, null=True, blank=True)),
9998
('feed', models.ForeignKey(to='multigtfs.Feed', on_delete=django.db.models.deletion.CASCADE)),
10099
],
101100
options={
@@ -112,7 +111,7 @@ class Migration(migrations.Migration):
112111
('end_time', multigtfs.models.fields.seconds.SecondsField(help_text='Time that the service ends at the specified frequency')),
113112
('headway_secs', models.IntegerField(help_text='Time in seconds before returning to same stop')),
114113
('exact_times', models.CharField(blank=True, help_text='Should frequency-based trips be exactly scheduled?', max_length=1, choices=[(0, 'Trips are not exactly scheduled'), (1, 'Trips are exactly scheduled from start time')])),
115-
('extra_data', jsonfield.fields.JSONField(default={}, null=True, blank=True)),
114+
('extra_data', models.JSONField(default={}, null=True, blank=True)),
116115
],
117116
options={
118117
'db_table': 'frequency',
@@ -133,7 +132,7 @@ class Migration(migrations.Migration):
133132
('color', models.CharField(help_text='Color of route in hex', max_length=6, blank=True)),
134133
('text_color', models.CharField(help_text='Color of route text in hex', max_length=6, blank=True)),
135134
('geometry', django.contrib.gis.db.models.fields.MultiLineStringField(help_text='Geometry cache of Trips', srid=4326, null=True, blank=True)),
136-
('extra_data', jsonfield.fields.JSONField(default={}, null=True, blank=True)),
135+
('extra_data', models.JSONField(default={}, null=True, blank=True)),
137136
('agency', models.ForeignKey(blank=True, to='multigtfs.Agency', help_text='Agency for this route.', null=True, on_delete=django.db.models.deletion.CASCADE)),
138137
('feed', models.ForeignKey(to='multigtfs.Feed', on_delete=django.db.models.deletion.CASCADE)),
139138
],
@@ -156,7 +155,7 @@ class Migration(migrations.Migration):
156155
('sunday', models.BooleanField(default=True, help_text='Is the route active on Sunday?')),
157156
('start_date', models.DateField(null=True, blank=True)),
158157
('end_date', models.DateField(null=True, blank=True)),
159-
('extra_data', jsonfield.fields.JSONField(default={}, null=True, blank=True)),
158+
('extra_data', models.JSONField(default={}, null=True, blank=True)),
160159
('feed', models.ForeignKey(to='multigtfs.Feed', on_delete=django.db.models.deletion.CASCADE)),
161160
],
162161
options={
@@ -170,7 +169,7 @@ class Migration(migrations.Migration):
170169
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
171170
('date', models.DateField(help_text='Date that the service differs from the norm.')),
172171
('exception_type', models.IntegerField(default=1, help_text='Is service added or removed on this date?', choices=[(1, 'Added'), (2, 'Removed')])),
173-
('extra_data', jsonfield.fields.JSONField(default={}, null=True, blank=True)),
172+
('extra_data', models.JSONField(default={}, null=True, blank=True)),
174173
('service', models.ForeignKey(to='multigtfs.Service', on_delete=django.db.models.deletion.CASCADE)),
175174
],
176175
options={
@@ -198,7 +197,7 @@ class Migration(migrations.Migration):
198197
('point', django.contrib.gis.db.models.fields.PointField(help_text='WGS 84 latitude/longitude of shape point', srid=4326)),
199198
('sequence', models.IntegerField()),
200199
('traveled', models.FloatField(help_text='Distance of point from start of shape', null=True, blank=True)),
201-
('extra_data', jsonfield.fields.JSONField(default={}, null=True, blank=True)),
200+
('extra_data', models.JSONField(default={}, null=True, blank=True)),
202201
('shape', models.ForeignKey(related_name='points', to='multigtfs.Shape', on_delete=django.db.models.deletion.CASCADE)),
203202
],
204203
options={
@@ -219,7 +218,7 @@ class Migration(migrations.Migration):
219218
('location_type', models.CharField(blank=True, help_text='Is this a stop or station?', max_length=1, choices=[('0', 'Stop'), ('1', 'Station')])),
220219
('timezone', models.CharField(help_text='Timezone of the stop', max_length=255, blank=True)),
221220
('wheelchair_boarding', models.CharField(blank=True, help_text='Is wheelchair boarding possible?', max_length=1, choices=[('0', 'No information'), ('1', 'Some wheelchair boarding'), ('2', 'No wheelchair boarding')])),
222-
('extra_data', jsonfield.fields.JSONField(default={}, null=True, blank=True)),
221+
('extra_data', models.JSONField(default={}, null=True, blank=True)),
223222
('feed', models.ForeignKey(to='multigtfs.Feed', on_delete=django.db.models.deletion.CASCADE)),
224223
('parent_station', models.ForeignKey(blank=True, to='multigtfs.Stop', help_text='The station associated with the stop', null=True, on_delete=django.db.models.deletion.CASCADE)),
225224
],
@@ -239,7 +238,7 @@ class Migration(migrations.Migration):
239238
('pickup_type', models.CharField(blank=True, help_text='How passengers are picked up', max_length=1, choices=[('0', 'Regularly scheduled pickup'), ('1', 'No pickup available'), ('2', 'Must phone agency to arrange pickup'), ('3', 'Must coordinate with driver to arrange pickup')])),
240239
('drop_off_type', models.CharField(blank=True, help_text='How passengers are picked up', max_length=1, choices=[('0', 'Regularly scheduled drop off'), ('1', 'No drop off available'), ('2', 'Must phone agency to arrange drop off'), ('3', 'Must coordinate with driver to arrange drop off')])),
241240
('shape_dist_traveled', models.FloatField(help_text='Distance of stop from start of shape', null=True, verbose_name='shape distance traveled', blank=True)),
242-
('extra_data', jsonfield.fields.JSONField(default={}, null=True, blank=True)),
241+
('extra_data', models.JSONField(default={}, null=True, blank=True)),
243242
('stop', models.ForeignKey(to='multigtfs.Stop', on_delete=django.db.models.deletion.CASCADE)),
244243
],
245244
options={
@@ -253,7 +252,7 @@ class Migration(migrations.Migration):
253252
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
254253
('transfer_type', models.IntegerField(default=0, help_text='What kind of transfer?', blank=True, choices=[(0, 'Recommended transfer point'), (1, 'Timed transfer point (vehicle will wait)'), (2, 'min_transfer_time needed to successfully transfer'), (3, 'No transfers possible')])),
255254
('min_transfer_time', models.IntegerField(help_text='How many seconds are required to transfer?', null=True, blank=True)),
256-
('extra_data', jsonfield.fields.JSONField(default={}, null=True, blank=True)),
255+
('extra_data', models.JSONField(default={}, null=True, blank=True)),
257256
('from_stop', models.ForeignKey(related_name='transfer_from_stop', to='multigtfs.Stop', help_text='Stop where a connection between routes begins.', on_delete=django.db.models.deletion.CASCADE)),
258257
('to_stop', models.ForeignKey(related_name='transfer_to_stop', to='multigtfs.Stop', help_text='Stop where a connection between routes ends.', on_delete=django.db.models.deletion.CASCADE)),
259258
],
@@ -273,7 +272,7 @@ class Migration(migrations.Migration):
273272
('geometry', django.contrib.gis.db.models.fields.LineStringField(help_text='Geometry cache of Shape or Stops', srid=4326, null=True, blank=True)),
274273
('wheelchair_accessible', models.CharField(blank=True, help_text='Are there accommodations for riders with wheelchair?', max_length=1, choices=[('0', 'No information'), ('1', 'Some wheelchair accommodation'), ('2', 'No wheelchair accommodation')])),
275274
('bikes_allowed', models.CharField(blank=True, help_text='Are bicycles allowed?', max_length=1, choices=[('0', 'No information'), ('1', 'Some bicycle accommodation'), ('2', 'No bicycles allowed')])),
276-
('extra_data', jsonfield.fields.JSONField(default={}, null=True, blank=True)),
275+
('extra_data', models.JSONField(default={}, null=True, blank=True)),
277276
('block', models.ForeignKey(blank=True, to='multigtfs.Block', help_text='Block of sequential trips that this trip belongs to.', null=True, on_delete=django.db.models.deletion.CASCADE)),
278277
('route', models.ForeignKey(to='multigtfs.Route', on_delete=django.db.models.deletion.CASCADE)),
279278
('service', models.ForeignKey(blank=True, to='multigtfs.Service', null=True, on_delete=django.db.models.deletion.CASCADE)),

multigtfs/models/agency.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
from __future__ import unicode_literals
1717

18-
from jsonfield import JSONField
19-
2018
from multigtfs.models.base import models, Base
2119

2220

@@ -45,7 +43,7 @@ class Agency(Base):
4543
help_text="Voice telephone number")
4644
fare_url = models.URLField(
4745
blank=True, help_text="URL for purchasing tickets online")
48-
extra_data = JSONField(default={}, blank=True, null=True)
46+
extra_data = models.JSONField(default=dict, blank=True, null=True)
4947

5048
def __str__(self):
5149
return u"%d-%s" % (self.feed.id, self.agency_id)

multigtfs/models/fare.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
# limitations under the License.
1515
from __future__ import unicode_literals
1616

17-
from jsonfield import JSONField
18-
1917
from multigtfs.models.base import models, Base
2018

2119

@@ -47,7 +45,7 @@ class Fare(Base):
4745
transfer_duration = models.IntegerField(
4846
null=True, blank=True,
4947
help_text="Time in seconds until a ticket or transfer expires")
50-
extra_data = JSONField(default={}, blank=True, null=True)
48+
extra_data = models.JSONField(default=dict, blank=True, null=True)
5149

5250
def __str__(self):
5351
return u"%d-%s(%s %s)" % (

multigtfs/models/fare_rule.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
# limitations under the License.
1515
from __future__ import unicode_literals
1616

17-
from jsonfield import JSONField
18-
1917
from multigtfs.models.base import models, Base
2018

2119

@@ -37,7 +35,7 @@ class FareRule(Base):
3735
'Zone', null=True, blank=True, on_delete=models.SET_NULL,
3836
related_name='fare_contains',
3937
help_text="Fare class is valid for travel withing this zone.")
40-
extra_data = JSONField(default={}, blank=True, null=True)
38+
extra_data = models.JSONField(default=dict, blank=True, null=True)
4139

4240
def __str__(self):
4341
u = "%d-%s" % (self.fare.feed.id, self.fare.fare_id)

multigtfs/models/feed.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121

2222
from django.contrib.gis.db import models
2323
from django.db.models.signals import post_save
24-
from jsonfield import JSONField
25-
2624
from multigtfs.compat import open_writable_zipfile, opener_from_zipfile
2725
from .agency import Agency
2826
from .fare import Fare
@@ -49,7 +47,7 @@ class Feed(models.Model):
4947
"""
5048
name = models.CharField(max_length=255)
5149
created = models.DateTimeField(auto_now_add=True)
52-
meta = JSONField(default={}, blank=True, null=True)
50+
meta = models.JSONField(default=dict, blank=True, null=True)
5351

5452
class Meta:
5553
db_table = 'feed'

multigtfs/models/feed_info.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
# limitations under the License.
1515
from __future__ import unicode_literals
1616

17-
from jsonfield import JSONField
18-
1917
from multigtfs.models.base import models, Base
2018

2119

@@ -43,7 +41,7 @@ class FeedInfo(Base):
4341
version = models.CharField(
4442
max_length=255, blank=True,
4543
help_text="Version of feed.")
46-
extra_data = JSONField(default={}, blank=True, null=True)
44+
extra_data = models.JSONField(default=dict, blank=True, null=True)
4745

4846
def __str__(self):
4947
return '%s-%s' % (self.feed.id, self.publisher_name)

multigtfs/models/frequency.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
# limitations under the License.
1515
from __future__ import unicode_literals
1616

17-
from jsonfield import JSONField
18-
1917
from multigtfs.models.base import models, Base
2018
from multigtfs.models.fields import SecondsField
2119

@@ -34,7 +32,7 @@ class Frequency(Base):
3432
choices=(('0', 'Trips are not exactly scheduled'),
3533
('1', 'Trips are exactly scheduled from start time')),
3634
help_text="Should frequency-based trips be exactly scheduled?")
37-
extra_data = JSONField(default={}, blank=True, null=True)
35+
extra_data = models.JSONField(default=dict, blank=True, null=True)
3836

3937
def __str__(self):
4038
return str(self.trip)

multigtfs/models/route.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
from __future__ import unicode_literals
1616

1717
from django.contrib.gis.geos import MultiLineString
18-
from jsonfield import JSONField
19-
2018
from multigtfs.models.base import models, Base
2119

2220

@@ -65,7 +63,7 @@ class Route(Base):
6563
geometry = models.MultiLineStringField(
6664
null=True, blank=True,
6765
help_text='Geometry cache of Trips')
68-
extra_data = JSONField(default={}, blank=True, null=True)
66+
extra_data = models.JSONField(default=dict, blank=True, null=True)
6967

7068
def update_geometry(self):
7169
"""Update the geometry from the Trips"""

multigtfs/models/service.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
# limitations under the License.
1515
from __future__ import unicode_literals
1616

17-
from jsonfield import JSONField
18-
1917
from multigtfs.models.base import models, Base
2018

2119

@@ -52,7 +50,7 @@ class Service(Base):
5250
help_text="Is the route active on Sunday?")
5351
start_date = models.DateField(null=True, blank=True)
5452
end_date = models.DateField(null=True, blank=True)
55-
extra_data = JSONField(default={}, blank=True, null=True)
53+
extra_data = models.JSONField(default=dict, blank=True, null=True)
5654

5755
def __str__(self):
5856
return "%d-%s" % (self.feed.id, self.service_id)

0 commit comments

Comments
 (0)