Changeset 215:307f33589e18


Ignore:
Timestamp:
13/10/10 13:12:54 (3 years ago)
Author:
nicoechaniz <nico@…>
Branch:
default
Message:

made creation_date editable in admin. removed wrong RSS results ordering until fixed

Files:
5 added
5 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • .hgignore

    r188 r215  
    1919django_cyclope.egg-info 
    2020fulldb.json 
     21.emacs.desktop 
  • cyclope/apps/articles/admin.py

    r211 r215  
    6464                    'classes': ('collapse',), 
    6565                    'fields':('source', 'tags', 'pretitle', 
    66                               'summary', 'date', 'allow_comments')}), 
     66                              'summary', 'date', 'allow_comments', 'creation_date')}), 
    6767                ) 
    6868 
  • cyclope/apps/articles/models.py

    r206 r215  
    11#!/usr/bin/env python 
    2 # -*- coding: UTF-8 -*- 
     2# -*- coding: utf-8 -*- 
    33# 
    44# Copyright 2010 Código Sur - Nuestra América Asoc. Civil / Fundación Pacificar. 
     
    6161        verbose_name = _('article') 
    6262        verbose_name_plural = _('articles') 
    63         ordering = ('-modification_date', 'name') 
     63        ordering = ('-creation_date', 'name') 
    6464 
  • cyclope/apps/medialibrary/models.py

    r144 r215  
    11#!/usr/bin/env python 
    2 # -*- coding: UTF-8 -*- 
     2# -*- coding: utf-8 -*- 
    33# 
    44# Copyright 2010 Código Sur - Nuestra América Asoc. Civil / Fundación Pacificar. 
     
    3939    class Meta: 
    4040        abstract = True 
     41        ordering = ('-creation_date', 'name') 
    4142 
    4243 
  • cyclope/core/collections/frontend_views.py

    r207 r215  
    11#!/usr/bin/env python 
    2 # -*- coding: UTF-8 -*- 
     2# -*- coding: utf-8 -*- 
    33# 
    44# Copyright 2010 Código Sur - Nuestra América Asoc. Civil / Fundación Pacificar. 
     
    6868    def get_string_response(self, request, content_object=None, *args, **kwargs): 
    6969        category = content_object 
    70         c = RequestContext(request, 
    71                            {'categorizations': category.categorizations.all(), 
     70        categorizations_list = category.categorizations.all() 
     71 
     72        c = RequestContext(request, 
     73                           {'categorizations': categorizations_list, 
    7274                            'region_view': True, 
    7375                            'category': category}) 
  • cyclope/feeds.py

    r212 r215  
    11#!/usr/bin/env python 
    2 # -*- coding: UTF-8 -*- 
     2# -*- coding: utf-8 -*- 
    33# 
    44# Copyright 2010 Código Sur - Nuestra América Asoc. Civil / Fundación Pacificar. 
     
    4747        objs = [] 
    4848        for ctype in sites.site.base_content_types.keys(): 
    49             objs.extend(list(ctype.objects.all().order_by('-creation_date')[:N])) 
     49            objs.extend(list(ctype.objects.all().order_by('-content_object__creation_date')[:N])) 
    5050        return sorted(objs, key=lambda x: x.creation_date, reverse = True)[:N] 
    5151 
     
    7676        N = cyc_settings.CYCLOPE_RSS_LIMIT 
    7777        return [c.content_object for c in 
    78                 category.categorizations.order_by('-creation_date')[:N]] 
     78                category.categorizations.all()[:N]] 
  • cyclope/migrations/0009_move_image_data_to_picture.py

    r206 r215  
    2929 
    3030    def forwards(self, orm): 
    31         from cyclope.apps.articles.models import Article, ArticleImageData 
    32         from cyclope.apps.medialibrary.models import Picture 
    33         # we work with the actual models here because managing these generic relations with south is very complex 
     31        # we work with the actual models here because managing these generic relations with south is very complex and we won't be migrating backwards 
     32 
     33        try: 
     34            from cyclope.apps.articles.models import Article, ArticleImageData 
     35            from cyclope.apps.medialibrary.models import Picture 
     36        except: 
     37            return 
     38         
    3439        for article in Article.objects.all(): 
    3540            if article.images: 
  • cyclope/models.py

    r214 r215  
    11#!/usr/bin/env python 
    2 # -*- coding: UTF-8 -*- 
     2# -*- coding: utf-8 -*- 
    33# 
    44# Copyright 2010 Código Sur - Nuestra América Asoc. Civil / Fundación Pacificar. 
     
    271271                                               object_id_field='self_id', 
    272272                                               content_type_field='self_type') 
    273     creation_date = models.DateTimeField(_('creation date'), auto_now_add=True, 
    274                                          editable=False, default=datetime.now()) 
     273    creation_date = models.DateTimeField(_('creation date'), 
     274                                         editable=True, default=datetime.now()) 
    275275    modification_date = models.DateTimeField(_('modification date'), auto_now=True, 
    276276                                             editable=False, default=datetime.now()) 
  • cyclope/tests.py

    r154 r215  
    11#!/usr/bin/env python 
    2 # -*- coding: UTF-8 -*- 
     2# -*- coding: utf-8 -*- 
    33# 
    44# Copyright 2010 Código Sur - Nuestra América Asoc. Civil / Fundación Pacificar. 
     
    3535from cyclope.apps.articles.models import Article 
    3636from cyclope.apps.medialibrary.models import * 
     37from cyclope.apps.polls.models import * 
    3738 
    3839def create_static_page(name=None): 
     
    268269 
    269270    def test_creation(self): 
    270         Article.objects.create(name='An instance') 
     271        author = Author.objects.create(name="the author") 
     272        Article.objects.create(name='An instance', author=author) 
    271273        an_instance = Article.objects.get(slug='an-instance') 
    272274        self.assertEqual(an_instance.name, 'An instance') 
    273275 
    274276    def test_content_views(self): 
    275         content_urls = get_content_urls(Article) 
     277        author = Author.objects.create(name="the author") 
     278        an_instance = Article.objects.create(name='An instance', author=author) 
     279        content_urls = get_content_urls(Article, an_instance) 
    276280        for url in content_urls: 
    277281            self.assertEqual(self.client.get(url).status_code, 200) 
     
    367371        for url in content_urls: 
    368372            self.assertEqual(self.client.get(url).status_code, 200) 
     373 
     374 
     375class PollTestCase(TestCase): 
     376    def setUp(self): 
     377        frontend.autodiscover() 
     378 
     379    def test_creation(self): 
     380        Poll.objects.create(name='An instance') 
     381        an_instance = Poll.objects.get(slug='an-instance') 
     382        self.assertEqual(an_instance.name, 'An instance') 
     383 
     384    def test_content_views(self): 
     385        content_urls = get_content_urls(Poll) 
     386        for url in content_urls: 
     387            self.assertEqual(self.client.get(url).status_code, 200) 
Note: See TracChangeset for help on using the changeset viewer.