Skip to content
This repository has been archived by the owner on May 31, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
karambir committed Aug 14, 2013
2 parents a9c3d6a + 17dbce8 commit 2827a62
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 17 deletions.
9 changes: 7 additions & 2 deletions profiles/admin.py
@@ -1,5 +1,10 @@
from django.contrib import admin
from .models import UserProfile, Snippet, Project, Badge, SavedResource, TopicFollow
from .models import UserProfile, Snippet, Project, SavedResource, TopicFollow

class UserProfileAdmin(admin.ModelAdmin):
list_display = ('user', 'receive_email',)
search_fields = ('user', 'bio', 'gravatar_email', 'twitter', 'stackoverflow', 'facebook', 'website', 'receive_email')


class SavedResourceAdmin(admin.ModelAdmin):
list_display = ('user', 'resource', 'saved_at')
Expand All @@ -21,8 +26,8 @@ class ProjectAdmin(admin.ModelAdmin):
list_display=('title', 'user', )
search_fields = ['title', 'description', 'url', 'source_url']

admin.site.register(UserProfile, UserProfileAdmin)
admin.site.register(Snippet, SnippetAdmin)
admin.site.register(Project, ProjectAdmin)
admin.site.register(Badge)
admin.site.register(SavedResource, SavedResourceAdmin)
admin.site.register(TopicFollow, TopicFollowAdmin)
159 changes: 159 additions & 0 deletions profiles/migrations/0003_auto__del_badge.py
@@ -0,0 +1,159 @@
# -*- 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):
# Deleting model 'Badge'
db.delete_table('profiles_badge')

# Removing M2M table for field badges on 'UserProfile'
db.delete_table('profiles_userprofile_badges')


def backwards(self, orm):
# Adding model 'Badge'
db.create_table('profiles_badge', (
('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('help_text', self.gf('django.db.models.fields.CharField')(max_length=220)),
('slug', self.gf('django.db.models.fields.SlugField')(default='', max_length=255, blank=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=30)),
))
db.send_create_signal('profiles', ['Badge'])

# Adding M2M table for field badges on 'UserProfile'
db.create_table('profiles_userprofile_badges', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('userprofile', models.ForeignKey(orm['profiles.userprofile'], null=False)),
('badge', models.ForeignKey(orm['profiles.badge'], null=False))
))
db.create_unique('profiles_userprofile_badges', ['userprofile_id', 'badge_id'])


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'})
},
'profiles.project': {
'Meta': {'object_name': 'Project'},
'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'source_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '60'}),
'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'profiles.savedresource': {
'Meta': {'unique_together': "(('user', 'resource'),)", 'object_name': 'SavedResource'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'resource': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['resources.Resource']"}),
'saved_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'profiles.snippet': {
'Meta': {'object_name': 'Snippet'},
'content': ('django.db.models.fields.TextField', [], {}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'show': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'profiles.topicfollow': {
'Meta': {'unique_together': "(('user', 'topic'),)", 'object_name': 'TopicFollow'},
'followed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'topic': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['resources.Topic']"}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'profiles.userprofile': {
'Meta': {'object_name': 'UserProfile'},
'bio': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'facebook': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
'github': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
'gravatar_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'receive_email': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'stackoverflow': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
'twitter': ('django.db.models.fields.CharField', [], {'max_length': '30', 'null': 'True', 'blank': 'True'}),
'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True'}),
'website': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'})
},
'resources.resource': {
'Meta': {'object_name': 'Resource'},
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
'description': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True', 'blank': 'True'}),
'help_text': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'level': ('django.db.models.fields.CharField', [], {'max_length': '30'}),
'rating_score': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
'rating_votes': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'blank': 'True'}),
'resource_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['resources.ResourceType']"}),
'show': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'default': "''", 'max_length': '255', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
'topics': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['resources.Topic']", 'symmetrical': 'False'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'url': ('django.db.models.fields.URLField', [], {'unique': 'True', 'max_length': '200'})
},
'resources.resourcetype': {
'Meta': {'object_name': 'ResourceType'},
'color': ('django.db.models.fields.CharField', [], {'default': "'purple'", 'unique': 'True', 'max_length': '20'}),
'help_text': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '60'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255'})
},
'resources.topic': {
'Meta': {'ordering': "['name']", 'object_name': 'Topic'},
'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'help_text': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '60'}),
'official_website': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '255'}),
'thumbnail': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'})
}
}

complete_apps = ['profiles']
11 changes: 0 additions & 11 deletions profiles/models.py
Expand Up @@ -15,16 +15,6 @@ def __unicode__(self):
return self.title


class Badge(models.Model):
name = models.CharField(max_length=30)
slug = models.SlugField(max_length=255, blank=True, default='')
help_text = models.CharField(max_length=220)
description = models.TextField(null=True, blank=True)

def __unicode__(self):
return self.name


class Snippet(models.Model):
title = models.CharField(max_length=255)
content = models.TextField()
Expand All @@ -51,7 +41,6 @@ class UserProfile(models.Model):
stackoverflow = models.CharField('Stackoverflow Profile', max_length=30, null=True, blank=True)
facebook = models.CharField('Facebook Username', max_length=30, null=True, blank=True)
website = models.URLField('Your Website/Blog', null=True, blank=True)
badges = models.ManyToManyField(Badge, null=True, blank=True)
receive_email = models.BooleanField(default=True)

def __unicode__(self):
Expand Down
4 changes: 2 additions & 2 deletions resources/templates/resources/resource_detail.html
Expand Up @@ -34,7 +34,7 @@ <h1><a href="{{ resource.url }}">{{ resource.title }}</a></h1>
{% include "resources/rating.html" %}
{% else %}
<div class="btn-group">
<a href="{% url 'auth_login' %}?next={% url 'resource_detail' pk=resource.pk %}" class="btn btn-warning btn-small"><i class="icon-info"></i> Login to rate or save this resource</a>
<a href="{% url 'auth_login' %}?next={% url 'resource_detail' pk=resource.pk %}" class="btn btn-small"><i class="icon-info"></i> Login to rate or save this resource</a>
</div>
{% endif %}

Expand All @@ -49,7 +49,7 @@ <h1><a href="{{ resource.url }}">{{ resource.title }}</a></h1>
<table class="table table-bordered table-stripped">
<tbody> {% with approval=resource.rating.get_real_rating %}
<tr class="{% if approval >= 3 %}success{% endif %}">
<td>User Approval Rate</td> <td>{{ approval|floatformat }}/5</td>
<td>Rating</td> <td>{{ approval|floatformat }}/5</td>
</tr>{% endwith %}
<tr>
<td>Resource Type</td> <td>{{ resource.resource_type }}</td>
Expand Down
2 changes: 1 addition & 1 deletion resources/templates/resources/single_resource_snippet.html
Expand Up @@ -23,6 +23,6 @@ <h4><a href="{{ resource.url }}">{{ resource.title }}</a> <small>{{ resource.url
<a href="{% url 'resource_feature' pk=resource.id slug=current_topic.slug %}" class="btn btn-small {% if resource.check_featured %}btn-inverse disabled{% endif %}"><i class="icon-fire"></i></a>
{% endif %}
{% else %}
<a href="{% url 'auth_login' %}?next={{ request.path }}" class="btn btn-info btn-small"><i class="icon-info"></i> Login to rate or save this resource</a>
<a href="{% url 'auth_login' %}?next={{ request.path }}" class="btn btn-small"><i class="icon-info"></i> Login to rate or save this resource</a>
{% endif %}
</li>
2 changes: 1 addition & 1 deletion templates/snippets/footer.html
Expand Up @@ -6,7 +6,7 @@
<ul class="footer-links unstyled">
<li><a href="{% url 'page_about' %}">About</a></li>
<li><a href="{% url 'page_contact' %}">Contact</a></li>
<li><a href="{% url 'page_guidelines' %}">Guidelines</a></li>
<li>Codesters &copy; 2013</li>
</ul>
</div>
<div class="span5">
Expand Down

0 comments on commit 2827a62

Please sign in to comment.