Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate user data type from int to charfield #517

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jet/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '1.0.7'
VERSION = '1.1.0'
18 changes: 18 additions & 0 deletions jet/dashboard/migrations/0002_user_charfield.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2 on 2019-04-23 19:24

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dashboard', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='userdashboardmodule',
name='user',
field=models.CharField(max_length=255, verbose_name='user'),
),
]
3 changes: 2 additions & 1 deletion jet/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _

from jet.utils import LazyDateTimeEncoder


Expand All @@ -11,7 +12,7 @@ class UserDashboardModule(models.Model):
title = models.CharField(verbose_name=_('Title'), max_length=255)
module = models.CharField(verbose_name=_('module'), max_length=255)
app_label = models.CharField(verbose_name=_('application name'), max_length=255, null=True, blank=True)
user = models.PositiveIntegerField(verbose_name=_('user'))
user = models.CharField(verbose_name=_('user'), max_length=255)
column = models.PositiveIntegerField(verbose_name=_('column'))
order = models.IntegerField(verbose_name=_('order'))
settings = models.TextField(verbose_name=_('settings'), default='', blank=True)
Expand Down
23 changes: 23 additions & 0 deletions jet/migrations/0003_user_charfield.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 2.2 on 2019-04-23 19:24

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('jet', '0002_delete_userdashboardmodule'),
]

operations = [
migrations.AlterField(
model_name='bookmark',
name='user',
field=models.CharField(max_length=255, verbose_name='user'),
),
migrations.AlterField(
model_name='pinnedapplication',
name='user',
field=models.CharField(max_length=255, verbose_name='user'),
),
]
4 changes: 2 additions & 2 deletions jet/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class Bookmark(models.Model):
url = models.URLField(verbose_name=_('URL'))
title = models.CharField(verbose_name=_('title'), max_length=255)
user = models.PositiveIntegerField(verbose_name=_('user'))
user = models.CharField(verbose_name=_('user'), max_length=255)
date_add = models.DateTimeField(verbose_name=_('date created'), default=timezone.now)

class Meta:
Expand All @@ -23,7 +23,7 @@ def __str__(self):
@python_2_unicode_compatible
class PinnedApplication(models.Model):
app_label = models.CharField(verbose_name=_('application name'), max_length=255)
user = models.PositiveIntegerField(verbose_name=_('user'))
user = models.CharField(verbose_name=_('user'), max_length=255)
date_add = models.DateTimeField(verbose_name=_('date created'), default=timezone.now)

class Meta:
Expand Down
13 changes: 13 additions & 0 deletions jet/tests/test_fields.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from django.db.models import PositiveIntegerField
from django.test import TestCase

from jet.fields import get_user_field


class UserFieldTest(TestCase):

def test_default_user_field(self):
default_cls = PositiveIntegerField
cls = get_user_field()
self.assertIsNotNone(cls)
self.assertEqual(cls, default_cls)