Re-enable Disqus comments on blogs, with option to use custom Disqus shortname. For #52
parent
e52fe5237e
commit
b6ec26d428
|
@ -0,0 +1,73 @@
|
|||
# -*- coding: 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 'UserProfile.disqus_shortname'
|
||||
db.add_column('accounts_userprofile', 'disqus_shortname',
|
||||
self.gf('django.db.models.fields.CharField')(max_length=250, null=True, blank=True),
|
||||
keep_default=False)
|
||||
|
||||
|
||||
def backwards(self, orm):
|
||||
# Deleting field 'UserProfile.disqus_shortname'
|
||||
db.delete_column('accounts_userprofile', 'disqus_shortname')
|
||||
|
||||
|
||||
models = {
|
||||
'accounts.userprofile': {
|
||||
'Meta': {'object_name': 'UserProfile'},
|
||||
'blog_domain': ('django.db.models.fields.CharField', [], {'max_length': '250', 'null': 'True', 'blank': 'True'}),
|
||||
'blog_theme': ('django.db.models.fields.CharField', [], {'default': "'D'", 'max_length': '1'}),
|
||||
'blog_title': ('django.db.models.fields.CharField', [], {'max_length': '250', 'null': 'True', 'blank': 'True'}),
|
||||
'disqus_shortname': ('django.db.models.fields.CharField', [], {'max_length': '250', 'null': 'True', 'blank': 'True'}),
|
||||
'gittip_username': ('django.db.models.fields.CharField', [], {'max_length': '250', 'null': 'True', 'blank': 'True'}),
|
||||
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||
'is_pro': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||
'stripe_id': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
|
||||
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'unique': 'True'})
|
||||
},
|
||||
'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'})
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['accounts']
|
|
@ -12,9 +12,11 @@ class UserProfile(models.Model):
|
|||
is_pro = models.BooleanField(default=False)
|
||||
stripe_id = models.CharField(max_length=100, null=True, blank=True)
|
||||
|
||||
gittip_username = models.CharField(max_length=250, null=True, blank=True)
|
||||
blog_title = models.CharField(max_length=250, null=True, blank=True)
|
||||
blog_theme = models.CharField(max_length=1, null=False, blank=False, default='D', choices=THEME_CHOICES)
|
||||
blog_domain = models.CharField(max_length=250, null=True, blank=True)
|
||||
|
||||
gittip_username = models.CharField(max_length=250, null=True, blank=True)
|
||||
disqus_shortname = models.CharField(max_length=250, null=True, blank=True)
|
||||
|
||||
User.profile = property(lambda u: UserProfile.objects.get_or_create(user=u)[0])
|
||||
|
|
|
@ -25,13 +25,6 @@
|
|||
{% if request.user.profile.is_pro %}
|
||||
<form class="form-horizontal" action="/account/" method="post">
|
||||
<legend>Edit Pro settings</legend>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="id_gittip_username">GitTip username:</label>
|
||||
<div class="controls">
|
||||
{{ form.gittip_username }}
|
||||
<span class="help-block">Your <a href="https://www.gittip.com/">GitTip</a> username, if you have one.</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="id_blog_title">Blog title:</label>
|
||||
<div class="controls">
|
||||
|
@ -51,6 +44,19 @@
|
|||
<span class="help-block">Like 'snipt.nicksergeant.com' or 'nicksergeant.com' (without quotes). Set your CNAME / A-record to point to 96.126.110.160</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="id_gittip_username">GitTip username:</label>
|
||||
<div class="controls">
|
||||
{{ form.gittip_username }}
|
||||
<span class="help-block">Your <a href="https://www.gittip.com/">GitTip</a> username, if you have one.</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="id_disqus_shortname">Disqus shortname:</label>
|
||||
<div class="controls">
|
||||
{{ form.disqus_shortname }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-success">Save</button>
|
||||
</div>
|
||||
|
|
|
@ -21,10 +21,12 @@ def account(request):
|
|||
profile = request.user.profile
|
||||
|
||||
form = AccountForm(initial={
|
||||
'gittip_username': profile.gittip_username,
|
||||
'blog_title': profile.blog_title,
|
||||
'blog_theme': profile.blog_theme,
|
||||
'blog_domain': profile.blog_domain
|
||||
'blog_domain': profile.blog_domain,
|
||||
|
||||
'gittip_username': profile.gittip_username,
|
||||
'disqus_shortname': profile.disqus_shortname,
|
||||
})
|
||||
|
||||
return {
|
||||
|
|
|
@ -21,13 +21,8 @@
|
|||
{% endfor %}
|
||||
{% paginate %}
|
||||
</section>
|
||||
{% comment %}
|
||||
<script type="text/javascript" id="disqus">
|
||||
{% if blog_user.username == 'rochacbruno' %}
|
||||
var disqus_shortname = 'rochacbrunoblog';
|
||||
{% else %}
|
||||
var disqus_shortname = 'snipt-net';
|
||||
{% endif %}
|
||||
var disqus_shortname = '{% firstof blog_user.profile.disqus_shortname "snipt-net" %}';
|
||||
{% if debug %}
|
||||
var disqus_developer = 1;
|
||||
{% endif %}
|
||||
|
@ -51,5 +46,4 @@
|
|||
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
||||
}());
|
||||
</script>
|
||||
{% endcomment %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -18,14 +18,9 @@
|
|||
{% with 'true' as detail %}
|
||||
{% include "blogs/themes/default/snipt-list.html" %}
|
||||
{% endwith %}
|
||||
{% comment %}
|
||||
<div id="disqus_thread"></div>
|
||||
<script type="text/javascript">
|
||||
{% if blog_user.username == 'rochacbruno' %}
|
||||
var disqus_shortname = 'rochacbrunoblog';
|
||||
{% else %}
|
||||
var disqus_shortname = 'snipt-net';
|
||||
{% endif %}
|
||||
var disqus_shortname = '{% firstof blog_user.profile.disqus_shortname "snipt-net" %}';
|
||||
{% if debug %}
|
||||
var disqus_developer = 1;
|
||||
{% endif %}
|
||||
|
@ -39,7 +34,6 @@
|
|||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||||
})();
|
||||
</script>
|
||||
{% endcomment %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -10,9 +10,8 @@
|
|||
{% include "blogs/themes/pro-adams/snipt-list.html" %}
|
||||
{% endfor %}
|
||||
{% paginate %}
|
||||
{% comment %}
|
||||
<script type="text/javascript">
|
||||
var disqus_shortname = 'snipt-net';
|
||||
var disqus_shortname = '{% firstof blog_user.profile.disqus_shortname "snipt-net" %}';
|
||||
{% if debug %}
|
||||
var disqus_developer = 1;
|
||||
{% endif %}
|
||||
|
@ -23,5 +22,4 @@
|
|||
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
||||
}());
|
||||
</script>
|
||||
{% endcomment %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -35,10 +35,9 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
{% if detail %}
|
||||
{% comment %}
|
||||
<div id="disqus_thread"></div>
|
||||
<script type="text/javascript">
|
||||
var disqus_shortname = 'snipt-net';
|
||||
var disqus_shortname = '{% firstof blog_user.profile.disqus_shortname "snipt-net" %}';
|
||||
{% if debug %}
|
||||
var disqus_developer = 1;
|
||||
{% endif %}
|
||||
|
@ -51,7 +50,6 @@
|
|||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||||
})();
|
||||
</script>
|
||||
{% endcomment %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue