Commits

Andrés Reyes Monge committed 6d4fcc0

- Trabajando en el listado de blogs

Comments (0)

Files changed (16)

 .idea
 build
 data
+media_root
+static_root
 
 # build script local files
 build/buildinfo.properties

armonge_info/settings/__init__.py

 from armonge_info.settings.settings import *
 
 try:
-    from settings.local import *
+    from armonge_info.settings.local import *
 except ImportError:
     pass

armonge_info/settings/settings.py

     'django.contrib.admin',
     'compressor',
     'south',
+    'disqus',
 
     'tagging',
     'blog',

armonge_info/urls.py

 
 # Uncomment the next two lines to enable the admin:
 from django.contrib import admin
+from blog.views import PostListView
+
 admin.autodiscover()
 
 urlpatterns = patterns('',
-    url(r'^', include('blog.urls')),
-    # Uncomment the next line to enable the admin:
     url(r'^admin/', include(admin.site.urls)),
+    url(r'^blog', include('blog.urls')),
+    url(r'^$', PostListView.as_view(template_name='blog/post_list_with_content.html'), name='home'),
+    # Uncomment the next line to enable the admin:
+
 )

assets/css/style.less

-@import "bootstrap/bootstrap.less";
+@import "bootstrap/bootstrap.less";
+
+.post{
+    border-bottom: 1px
+}
Add a comment to this file

assets/img/glyphicons-halflings-white.png

Added
New image
Add a comment to this file

assets/img/glyphicons-halflings.png

Added
New image
+# -*- coding: utf-8 -*-
+
+from django.contrib import admin
+from blog.models import Post
+
+class PostAdmin(admin.ModelAdmin):
+    list_filter = ('tag_list',)
+    prepopulated_fields = {
+        'slug': ('name',),
+    }
+
+
+
+admin.site.register(Post, PostAdmin)

blog/migrations/0002_auto__del_field_post_tags__add_field_post_tag_list.py

+# -*- 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 field 'Post.tags'
+        db.delete_column('blog_post', 'tags')
+
+        # Adding field 'Post.tag_list'
+        db.add_column('blog_post', 'tag_list',
+                      self.gf('tagging.fields.TagField')(default=''),
+                      keep_default=False)
+
+
+    def backwards(self, orm):
+        # Adding field 'Post.tags'
+        db.add_column('blog_post', 'tags',
+                      self.gf('tagging.fields.TagField')(default=''),
+                      keep_default=False)
+
+        # Deleting field 'Post.tag_list'
+        db.delete_column('blog_post', 'tag_list')
+
+
+    models = {
+        'blog.post': {
+            'Meta': {'object_name': 'Post'},
+            'date_published': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+            'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
+            'tag_list': ('tagging.fields.TagField', [], {}),
+            'text': ('django.db.models.fields.TextField', [], {})
+        }
+    }
+
+    complete_apps = ['blog']
 import datetime
 from django.db import models
 from tagging.fields import TagField
+from tagging.models import Tag
 
 class Post(models.Model):
     name = models.CharField(max_length=200, verbose_name=u'nombre')
     text = models.TextField(verbose_name=u'texto')
     date_published = models.DateTimeField(default=datetime.datetime.now)
 
-    tags = TagField()
+    tag_list = TagField()
     public = models.BooleanField()
 
     @models.permalink
     def get_absolute_url(self):
-        return ('blog_detail', (),{
+        return ('blog_post_detail', (),{
             'slug': self.slug,
             'pk': self.pk
         })
 
     def __unicode__(self):
-        return self.name
+        return self.name
+
+
+    def save(self):
+        super(Post, self).save()
+        self.tags = self.tag_list
+
+    def _get_tags(self):
+        return Tag.objects.get_for_object(self)
+
+    def _set_tags(self, tag_list):
+        Tag.objects.update_tags(self, tag_list)
+
+    tags = property(_get_tags, _set_tags)

blog/templates/blog/post_detail.html

+{% extends 'base.html' %}
+{% load disqus_tags %}
+
+{% block title %}
+    {{ post }}
+{% endblock %}
+{% block content %}
+    <div class="row">
+        <h1 class="span">{{ post }}</h1>
+    </div>
+    <div class="row">
+        <div class="span">{{ post.text|linebreaks }}</div>
+    </div>
+    <div class="row">
+        <div class="span">
+            {% set_disqus_url post.get_absolute_url %}
+            {% set_disqus_title post.name %}
+            {% set_disqus_identifier post.id %}
+            {% disqus_show_comments %}
+        </div>
+    </div>
+{% endblock %}

blog/templates/blog/post_list.html

+{% extends 'base.html' %}
+{% load disqus_tags %}
+{% block content %}
+    {% for post in post_list %}
+        <div class="row post">
+            <div class="span2">
+                <span class="date"><i class="icon-calendar"></i> {{ post.date_published.date }}</span> <br>
+                <span class="tags">
+                    <i class="icon-tag"></i>
+                    {% for tag in post.tags %}
+                        <a href="{% url blog_post_list_by_tag tag %}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
+                    {% endfor %}
+                </span> <br>
+                <span class="comments"><i class="icon-comment"></i>
+                    <a href="{{ post.get_absolute_url}}#disqus_thread" data-disqus-identifier="{{ post.id }}">Comentarios</a>
+                    {% disqus_num_replies %}
+                </span> <br>
+
+            </div>
+            <div class="span">
+                <h1><a href="{{ post.get_absolute_url }}">{{ post }}</a></h1>
+            </div>
+        </div>
+    {% endfor %}
+{% endblock %}
 urlpatterns = patterns('blog.views',
     url(r'^(?P<pk>\d+)/(?P<slug>[\w-]+)/$', PostDetailView.as_view(), name='blog_post_detail'),
     url(r'^(?P<tag>[\w-]+)/$', PostListView.as_view(), name='blog_post_list_by_tag'),
-    url(r'^$',PostListView.as_view(), name='blog_post_list'),
+    url(r'$',PostListView.as_view(), name='blog_post_list'),
 )
 South
 django-compressor
 Django
+BeautifulSoup
 django-tagging
+django-disqus

templates/base.html

-<!doctype html>
+{% load compress %}<!doctype html>
 <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
 <!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
 <!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
   <meta name="description" content="">
 
   <meta name="viewport" content="width=device-width">
-  <link rel="stylesheet" href="{{ STATIC_URL }}css/style.less" type="text">
+    {% compress css %}
+    <link rel="stylesheet" href="{{ STATIC_URL }}css/style.less" type="text/less">
+    {% endcompress %}
 
   <script src="{{ STATIC_URL }}js/libs/modernizr-2.5.3.min.js"></script>
 </head>
 <body>
   <!--[if lt IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience this site.</p><![endif]-->
-  <header>
-      {% block header %}{% endblock %}
+  <header class="container">
+      {% block header %}
+          <div class="navbar">
+            <div class="navbar-inner">
+              <div class="container">
+                  <a class="brand" href="/">
+                    El Blog de armonge
+                  </a>
+                  <ul class="nav">
+                    <li><a href="/">Blog</a></li>
+                    <li><a href="{% url blog_post_list %}">Archivo</a></li>
+                  </ul>
+              </div>
+            </div>
+          </div>
+      {% endblock %}
   </header>
-  <div role="main">
+  <div role="main" class="container">
       {% block content %}{% endblock %}
   </div>
-  <footer>
-      {% block footer %}{% endblock %}
+  <footer class="container">
+      {% block footer %}
+      
+      {% endblock %}
   </footer>
 
 

templates/blog/post_list_with_content.html

+{% extends 'base.html' %}
+{% load disqus_tags %}
+{% block content %}
+    {% for post in post_list %}
+        <div class="row post">
+            <div class="span2">
+                <span class="date"><i class="icon-calendar"></i> {{ post.date_published.date }}</span> <br>
+                <span class="tags">
+                    <i class="icon-tag"></i>
+                    {% for tag in post.tags %}
+                        <a href="{% url blog_post_list_by_tag tag %}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
+                    {% endfor %}
+                </span> <br>
+                <span class="comments"><i class="icon-comment"></i>
+                    <a href="{{ post.get_absolute_url}}#disqus_thread" data-disqus-identifier="{{ post.id }}">Comentarios</a>
+                    {% disqus_num_replies %}
+                </span> <br>
+
+            </div>
+            <div class="span">
+                <h1><a href="{{ post.get_absolute_url }}">{{ post }}</a></h1>
+
+                <div>{{ post.text|linebreaks }}</div>
+
+            </div>
+        </div>
+    {% endfor %}
+{% endblock %}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.