Permalink
Browse files

Adding link for linkedin profile

  • Loading branch information...
1 parent 0de4c0f commit 134f57401c61fa8deed6cd6ea5bbdc411b2a2663 @d1ffuz0r committed Dec 20, 2011
@@ -0,0 +1,62 @@
+# 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 'Settings.linkedin'
+ db.add_column('homesite_settings', 'linkedin', self.gf('django.db.models.fields.CharField')(default='', max_length=100), keep_default=False)
+
+
+ def backwards(self, orm):
+
+ # Deleting field 'Settings.linkedin'
+ db.delete_column('homesite_settings', 'linkedin')
+
+
+ models = {
+ 'homesite.about': {
+ 'Meta': {'object_name': 'About'},
+ 'description': ('django.db.models.fields.TextField', [], {'max_length': '1000'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
+ },
+ 'homesite.blog': {
+ 'Meta': {'ordering': "['-id']", 'object_name': 'Blog'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'text': ('django.db.models.fields.TextField', [], {}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '1000'})
+ },
+ 'homesite.quickmessages': {
+ 'Meta': {'object_name': 'QuickMessages'},
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'message': ('django.db.models.fields.TextField', [], {'default': "u'Message'", 'max_length': '1000'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'homesite.services': {
+ 'Meta': {'object_name': 'Services'},
+ 'description': ('django.db.models.fields.TextField', [], {'max_length': '1000'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'blank': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '1000'})
+ },
+ 'homesite.settings': {
+ 'Meta': {'object_name': 'Settings'},
+ 'cv': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}),
+ 'email': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'facebook': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'github': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'icq': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'jabber': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'linkedin': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'skype': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'twitter': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ }
+ }
+
+ complete_apps = ['homesite']
View
@@ -43,6 +43,7 @@ class Settings(models.Model):
skype = models.CharField(max_length=100,
verbose_name=u"Skype")
cv = models.FileField(upload_to=".", verbose_name=u"CV", blank=True)
+ linkedin = models.CharField(max_length=100, verbose_name=u"LinkedIn")
class Meta:
verbose_name = u"Settings"
@@ -1,33 +1,45 @@
from django import template
from homesite.forms import QuickContactForm
from homesite.models import Blog, Settings
+from django.core.exceptions import ObjectDoesNotExist
register = template.Library()
@register.simple_tag
def quick_form():
- """quick message form
+ """
+ Quick message form
Example: {% quick_form %}
"""
return QuickContactForm().as_p()
@register.simple_tag(takes_context=True)
def social(context):
- settings = Settings.objects.all()[0]
+ """
+ Settings for getting social links
+ """
+ try:
+ settings = Settings.objects.get()
+ except ObjectDoesNotExist:
+ settings = None
context["social"] = settings
return u""
@register.simple_tag(takes_context=True)
def latest_posts(context):
- """latest posts in blog
+ """
+ Latest posts in blog
example: {{ latest_posts }}
{% for post in latest_posts %}
...
{% endfor %}
"""
- posts = Blog.objects.all()[:4]
+ try:
+ posts = Blog.objects.all()[:4]
+ except ObjectDoesNotExist:
+ posts = None
context["latest_posts"] = posts
return u""
View
@@ -21,9 +21,13 @@ def setUp(self):
icq="12123",
email="test@dsfdsf.com",
skype="sfsdf",
- cv=""
+ cv="",
+ linkedin="linked.in"
)
+ def test_linkedin(self):
+ self.assertEqual(self.settings.linkedin, "linked.in")
+
def testHome(self):
request = self.client.get("/")
self.assertContains(request, text="portfolio")
@@ -142,7 +142,7 @@ body {
#social_link ul {
margin: 0;
padding: 0;
- width: 216px !important;
+ width: 238px !important;
height: 50px !important;
list-style: none;
float: left;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -42,6 +42,7 @@
<li><a href="{{ social.facebook }}" target="_blank"><img src="{{ STATIC_URL }}images/social/facebook.png" alt=""></a></li>
<li><a href="{{ social.twitter }}" target="_blank"><img src="{{ STATIC_URL }}images/social/twitter.png" alt=""></a></li>
<li><a href="{{ social.github }}" target="_blank"><img src="{{ STATIC_URL }}images/social/github.png" alt=""></a></li>
+ <li><a href="{{ social.linkedin }}" target="_blank"><img src="{{ STATIC_URL }}images/social/linkedin.png" alt=""></a></li>
</ul>
</div>
</div>
View
@@ -8,26 +8,32 @@
admin.autodiscover()
urlpatterns = patterns('',
- url(r'^$', ListView.as_view(queryset=Settings.objects.all()[0],
+ url(r'^$', ListView.as_view(queryset=Settings.objects.all(),
context_object_name="home",
template_name="home.html")),
- url(r'^about/', ListView.as_view(queryset=About.objects.all()[0],
+ url(r'^about/', ListView.as_view(queryset=About.objects.all(),
context_object_name="about",
template_name="about.html")),
url(r'^skills/', ListView.as_view(queryset=Services.objects.all(),
context_object_name="skills",
template_name="skills.html")),
-
- url(r'^contacts/', ListView.as_view(queryset=Settings.objects.all()[0],
+
+ url(r'^contacts/', ListView.as_view(queryset=Settings.objects.all(),
context_object_name="contacts",
template_name="contacts.html")),
url(r'^blog/rss/$', BlogRss()),
url(r'^blog/post/(\d+)', 'homesite.views.blog_post'),
url(r'^blog/', 'homesite.views.blog_list'),
url(r'^ajax/quick-form', 'homesite.views.quick_form'),
- url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
- url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
+ url(r'^media/(?P<path>.*)$',
+ 'django.views.static.serve',
+ {'document_root': settings.MEDIA_ROOT}
+ ),
+ url(r'^static/(?P<path>.*)$',
+ 'django.views.static.serve',
+ {'document_root': settings.STATIC_ROOT}
+ ),
url(r'^admin/', include(admin.site.urls)),
-)
+)

0 comments on commit 134f574

Please sign in to comment.