Skip to content
Browse files

Adding profile field for completing the tutorial.

  • Loading branch information...
1 parent 4275966 commit 913fc49c3a2079831cf45df964f1d8ebfd1e52a4 @samuelclay committed
Showing with 93 additions and 11 deletions.
  1. +81 −0 apps/profile/migrations/0013_tutorial_finished.py
  2. +10 −9 apps/profile/models.py
  3. +1 −1 apps/profile/views.py
  4. +1 −1 vendor/timezones/fields.py
View
81 apps/profile/migrations/0013_tutorial_finished.py
@@ -0,0 +1,81 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+
+ # Adding field 'Profile.tutorial_finished'
+ db.add_column('profile_profile', 'tutorial_finished', self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False)
+
+ # Changing field 'Profile.timezone'
+ db.alter_column('profile_profile', 'timezone', self.gf('vendor.timezones.fields.TimeZoneField')(max_length=100))
+
+
+ def backwards(self, orm):
+
+ # Deleting field 'Profile.tutorial_finished'
+ db.delete_column('profile_profile', 'tutorial_finished')
+
+ # Changing field 'Profile.timezone'
+ db.alter_column('profile_profile', 'timezone', self.gf('utils.timezones.fields.TimeZoneField')(max_length=100))
+
+
+ models = {
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'profile.profile': {
+ 'Meta': {'object_name': 'Profile'},
+ 'collapsed_folders': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
+ 'feed_pane_size': ('django.db.models.fields.IntegerField', [], {'default': '240'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_premium': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_seen_ip': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
+ 'last_seen_on': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'preferences': ('django.db.models.fields.TextField', [], {'default': "'{}'"}),
+ 'secret_token': ('django.db.models.fields.CharField', [], {'max_length': '12', 'null': 'True', 'blank': 'True'}),
+ 'timezone': ('vendor.timezones.fields.TimeZoneField', [], {'default': "'America/New_York'", 'max_length': '100'}),
+ 'tutorial_finished': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'profile'", 'unique': 'True', 'to': "orm['auth.User']"}),
+ 'view_settings': ('django.db.models.fields.TextField', [], {'default': "'{}'"})
+ }
+ }
+
+ complete_apps = ['profile']
View
19 apps/profile/models.py
@@ -15,16 +15,17 @@
from utils.user_functions import generate_secret_token
class Profile(models.Model):
- user = models.OneToOneField(User, unique=True, related_name="profile")
- is_premium = models.BooleanField(default=False)
- preferences = models.TextField(default="{}")
- view_settings = models.TextField(default="{}")
+ user = models.OneToOneField(User, unique=True, related_name="profile")
+ is_premium = models.BooleanField(default=False)
+ preferences = models.TextField(default="{}")
+ view_settings = models.TextField(default="{}")
collapsed_folders = models.TextField(default="[]")
- feed_pane_size = models.IntegerField(default=240)
- last_seen_on = models.DateTimeField(default=datetime.datetime.now)
- last_seen_ip = models.CharField(max_length=50, blank=True, null=True)
- timezone = TimeZoneField(default="America/New_York")
- secret_token = models.CharField(max_length=12, blank=True, null=True)
+ feed_pane_size = models.IntegerField(default=240)
+ tutorial_finished = models.BooleanField(default=False)
+ last_seen_on = models.DateTimeField(default=datetime.datetime.now)
+ last_seen_ip = models.CharField(max_length=50, blank=True, null=True)
+ timezone = TimeZoneField(default="America/New_York")
+ secret_token = models.CharField(max_length=12, blank=True, null=True)
def __unicode__(self):
return "%s" % self.user
View
2 apps/profile/views.py
@@ -12,7 +12,7 @@
from apps.profile.models import Profile, change_password
from apps.reader.models import UserSubscription
-SINGLE_FIELD_PREFS = ('timezone','feed_pane_size')
+SINGLE_FIELD_PREFS = ('timezone','feed_pane_size','tutorial_finished')
SPECIAL_PREFERENCES = ('old_password', 'new_password',)
@ajax_login_required
View
2 vendor/timezones/fields.py
@@ -9,7 +9,7 @@
from vendor.timezones.utilities import coerce_timezone_value, validate_timezone_max_length
from south.modelsinspector import add_introspection_rules
-add_introspection_rules([], ["^utils\.timezones\.fields\.TimeZoneField"])
+add_introspection_rules([], ["^vendor\.timezones\.fields\.TimeZoneField"])
MAX_TIMEZONE_LENGTH = getattr(settings, "MAX_TIMEZONE_LENGTH", 100)
default_tz = pytz.timezone(getattr(settings, "TIME_ZONE", "UTC"))

0 comments on commit 913fc49

Please sign in to comment.
Something went wrong with that request. Please try again.