Exemplo n.º 1
0
Arquivo: list.py Projeto: kidzik/mloss
def search_description(request, q):
    qs=Revision.objects.get_by_searchterm(q)
    if qs.count()==0:
        return render_to_response('software/software_list.html',
                get_latest_news({ 'search_term': q }),
                context_instance=RequestContext(request))
    else:
        return list_detail.object_list(request,
                                   paginate_by=10,
                                   queryset=qs,
                                   template_name='software/software_list.html',
                                   extra_context=get_latest_news({ 'search_term': q }),
                                   )
Exemplo n.º 2
0
def search_description(request, q):
    qs = Revision.objects.get_by_searchterm(q)
    if qs.count() == 0:
        return render_to_response('software/software_list.html',
                                  get_latest_news({'search_term': q}),
                                  context_instance=RequestContext(request))
    else:
        return list_detail.object_list(
            request,
            paginate_by=10,
            queryset=qs,
            template_name='software/software_list.html',
            extra_context=get_latest_news({'search_term': q}),
        )
Exemplo n.º 3
0
def get_summary_page(request):
    """
	Get a summary of:
	- Latest forum posts
	- Latest feeds from external sites
	"""
    return render_to_response("community/summary.html", RequestContext(request, get_latest_news()))
Exemplo n.º 4
0
def get_summary_page(request):
    """
	Get a summary of:
	- Latest forum posts
	- Latest feeds from external sites
	"""
    return render(request, 'community/summary.html',
                  {'context': get_latest_news()})
Exemplo n.º 5
0
def get_summary_page(request):
	"""
	Get a summary of:
	- Latest forum posts
	- Latest feeds from external sites
	"""
	return render(request, 'community/summary.html',
			{'context': get_latest_news()})
Exemplo n.º 6
0
def get_summary_page(request):
    """
	Get a summary of:
	- Latest forum posts
	- Latest feeds from external sites
	"""
    return render_to_response('community/summary.html',
                              RequestContext(request, get_latest_news()))
Exemplo n.º 7
0
def user_with_software(request):
    """Deprecated"""
    userlist = User.objects.filter(software__isnull=False).distinct().order_by('username')
    return DetailView.as_view(request,
                                   paginate_by=20,
                                   queryset=userlist,
                                   template_name='software/user_list.html',
                                   extra_context=get_latest_news(),
                                   )
Exemplo n.º 8
0
def software_all_dataformats(request):
    """Deprecated"""
    dataformatlist = DataFormat.objects.filter(name__isnull=False).distinct().order_by('slug')
    return DetailView.as_view(request,
                                   paginate_by=20,
                                   queryset=dataformatlist,
                                   template_name='software/dataformat_list.html',
                                   extra_context=get_latest_news(),
                                   )
Exemplo n.º 9
0
def software_all_opsyss(request):
    """Deprecated"""
    opsyslist = OpSys.objects.filter(name__isnull=False).distinct().order_by('slug')
    return DetailView.as_view(request,
                                   paginate_by=20,
                                   queryset=opsyslist,
                                   template_name='software/opsys_list.html',
                                   extra_context=get_latest_news(),
                                   )
Exemplo n.º 10
0
def software_in_jmlr(request):
    """
    List Software that appeared in JMLR
    """
    return list_detail.object_list(
        request,
        paginate_by=20,
        queryset=Revision.objects.get_jmlr().order_by('-updated_date'),
        extra_context=get_latest_news({'jmlr': True}),
        template_name='software/software_list.html')
Exemplo n.º 11
0
def software_in_jmlr(request):
    """
    Deprecated. List Software that appeared in JMLR
    """
    return list_detail.object_list(request,
                                   paginate_by=20,
                                   queryset=Revision.objects.get_jmlr().order_by('-updated_date'),
                                   extra_context=get_latest_news({ 'jmlr' : True }),
                                   template_name='software/software_list.html'
                                   )
Exemplo n.º 12
0
def software_by_user(request, username):
    """
    Deprecated. List of Software submitted by a particular User.
    """
    user = get_object_or_404(User, username__exact=username)
    return list_detail.object_list(request,
                                   paginate_by=20,
                                   queryset=Revision.objects.get_by_submitter(user.username).order_by('-updated_date'),
                                   extra_context=get_latest_news({ 'username' : user.username }),
                                   template_name='software/software_list.html'
                                   )
Exemplo n.º 13
0
def software_by_author(request, slug):
    """
    Deprecated. List of software with a particular Author
    """
    author = get_object_or_404(Author, slug__exact=slug)
    return list_detail.object_list(request,
                                   paginate_by=20,
                                   queryset=Revision.objects.get_by_author(author.slug).order_by('-updated_date'),
                                   extra_context=get_latest_news({ 'author' : author }),
                                   template_name='software/software_list.html',
                                   )
Exemplo n.º 14
0
def software_by_language(request, slug):
    """
    List of software with a particular Language
    """
    language = get_object_or_404(Language, slug__exact=slug)
    return list_detail.object_list(request,
                                   paginate_by=20,
                                   queryset=Revision.objects.get_by_language(language.slug).order_by('-updated_date'),
                                   extra_context=get_latest_news({ 'language' : language }),
                                   template_name='software/software_list.html',
                                   )
Exemplo n.º 15
0
def software_by_tag(request, slug):
    """
    List of software with a particular Tag
    """
    tag = get_object_or_404(Tag, slug__exact=slug)
    return list_detail.object_list(request,
                                   paginate_by=20,
                                   queryset=Revision.objects.get_by_tag(tag.slug).order_by('-updated_date'),
                                   extra_context=get_latest_news({ 'tags': tag }),
                                   template_name='software/software_list.html',
                                   )
Exemplo n.º 16
0
def software_by_dataformats(request, slug):
    """
    List of software with a particular Operating System
    """
    dataformat = get_object_or_404(DataFormat, slug__exact=slug)
    return list_detail.object_list(request,
                                   paginate_by=20,
                                   queryset=Revision.objects.get_by_dataformat(dataformat.slug).order_by('-updated_date'),
                                   extra_context=get_latest_news({ 'dataformat' : dataformat }),
                                   template_name='software/software_list.html',
                                   )
Exemplo n.º 17
0
def software_by_opsys(request, slug):
    """
    List of software with a particular Operating System
    """
    opsys = get_object_or_404(OpSys, slug__exact=slug)
    return list_detail.object_list(request,
                                   paginate_by=20,
                                   queryset=Revision.objects.get_by_opsys(opsys.slug).order_by('-updated_date'),
                                   extra_context=get_latest_news({ 'opsys' : opsys }),
                                   template_name='software/software_list.html',
                                   )
Exemplo n.º 18
0
def software_by_user(request, username):
    """
    List of Software submitted by a particular User.
    """
    user = get_object_or_404(User, username__exact=username)
    return list_detail.object_list(
        request,
        paginate_by=20,
        queryset=Revision.objects.get_by_submitter(
            user.username).order_by('-updated_date'),
        extra_context=get_latest_news({'username': user.username}),
        template_name='software/software_list.html')
Exemplo n.º 19
0
def software_by_rating(request):
    """
    Deprecated. List of Software ranked by rating
    """
    softwarelist = Revision.objects.filter(revision=0).order_by('-software__average_rating','-updated_date')

    return list_detail.object_list(request,
                                   paginate_by=10,
                                   queryset=softwarelist,
                                   template_name='software/software_list.html',
                                   extra_context=get_latest_news(),
                                   )
Exemplo n.º 20
0
def software_by_subscription(request):
    """
    List of Software ranked by number of subscription
    """
    softwarelist = Revision.objects.get_by_subscription()

    return list_detail.object_list(request,
                                   paginate_by=10,
                                   queryset=softwarelist,
                                   template_name='software/software_list.html',
                                   extra_context=get_latest_news(),
                                   )
Exemplo n.º 21
0
def software_by_dataformats(request, slug):
    """
    List of software with a particular Operating System
    """
    dataformat = get_object_or_404(DataFormat, slug__exact=slug)
    return list_detail.object_list(
        request,
        paginate_by=20,
        queryset=Revision.objects.get_by_dataformat(
            dataformat.slug).order_by('-updated_date'),
        extra_context=get_latest_news({'dataformat': dataformat}),
        template_name='software/software_list.html',
    )
Exemplo n.º 22
0
def software_by_subscription(request):
    """
    List of Software ranked by number of subscription
    """
    softwarelist = Revision.objects.get_by_subscription()

    return list_detail.object_list(
        request,
        paginate_by=10,
        queryset=softwarelist,
        template_name='software/software_list.html',
        extra_context=get_latest_news(),
    )
Exemplo n.º 23
0
Arquivo: list.py Projeto: Afelio/mloss
def software_by_title(request):
    """
    List of Software ranked by date
    """

    softwarelist = Revision.objects.filter(revision=0).order_by('software__title','-updated_date')

    return list_detail.object_list(request,
                                   paginate_by=10,
                                   queryset=softwarelist,
                                   template_name='software/software_list.html',
                                   extra_context=get_latest_news(),
                                   )
Exemplo n.º 24
0
def software_by_downloads(request):
    """
    Deprecated. List of Software ranked by downloads
    """

    softwarelist = Revision.objects.filter(revision=0).order_by('-software__total_number_of_downloads','-updated_date')

    return list_detail.object_list(request,
                                   paginate_by=10,
                                   queryset=softwarelist,
                                   template_name='software/software_list.html',
                                   extra_context=get_latest_news(),
                                   )
Exemplo n.º 25
0
def software_by_author(request, slug):
    """
    List of software with a particular Author
    """
    author = get_object_or_404(Author, slug__exact=slug)
    return list_detail.object_list(
        request,
        paginate_by=20,
        queryset=Revision.objects.get_by_author(
            author.slug).order_by('-updated_date'),
        extra_context=get_latest_news({'author': author}),
        template_name='software/software_list.html',
    )
Exemplo n.º 26
0
def software_by_tag(request, slug):
    """
    List of software with a particular Tag
    """
    tag = get_object_or_404(Tag, slug__exact=slug)
    return list_detail.object_list(
        request,
        paginate_by=20,
        queryset=Revision.objects.get_by_tag(
            tag.slug).order_by('-updated_date'),
        extra_context=get_latest_news({'tags': tag}),
        template_name='software/software_list.html',
    )
Exemplo n.º 27
0
def software_by_language(request, slug):
    """
    List of software with a particular Language
    """
    language = get_object_or_404(Language, slug__exact=slug)
    return list_detail.object_list(
        request,
        paginate_by=20,
        queryset=Revision.objects.get_by_language(
            language.slug).order_by('-updated_date'),
        extra_context=get_latest_news({'language': language}),
        template_name='software/software_list.html',
    )
Exemplo n.º 28
0
def software_by_opsys(request, slug):
    """
    List of software with a particular Operating System
    """
    opsys = get_object_or_404(OpSys, slug__exact=slug)
    return list_detail.object_list(
        request,
        paginate_by=20,
        queryset=Revision.objects.get_by_opsys(
            opsys.slug).order_by('-updated_date'),
        extra_context=get_latest_news({'opsys': opsys}),
        template_name='software/software_list.html',
    )
Exemplo n.º 29
0
def software_by_rating(request):
    """
    List of Software ranked by rating
    """
    softwarelist = Revision.objects.filter(revision=0).order_by(
        '-software__average_rating', '-updated_date')

    return list_detail.object_list(
        request,
        paginate_by=10,
        queryset=softwarelist,
        template_name='software/software_list.html',
        extra_context=get_latest_news(),
    )
Exemplo n.º 30
0
def forum(request, slug):
    """
 	Displays a list of threads within a forum.
 	Threads are sorted by their sticky flag, followed by their 
 	most recent post.
 	"""
    f = get_object_or_404(Forum, slug=slug)
    inputform = create_newthreadform(request)
    extra = get_latest_news()
    extra['forum'] = f
    extra['form'] = inputform
    extra['form_action'] = 'new/'
    extra['threads'] = f.thread_set.all().order_by('thread_latest_post')

    return render(request, 'community/thread_list.html', {'context': extra})
Exemplo n.º 31
0
def software_by_downloads(request):
    """
    List of Software ranked by downloads
    """

    softwarelist = Revision.objects.filter(revision=0).order_by(
        '-software__total_number_of_downloads', '-updated_date')

    return list_detail.object_list(
        request,
        paginate_by=10,
        queryset=softwarelist,
        template_name='software/software_list.html',
        extra_context=get_latest_news(),
    )
Exemplo n.º 32
0
def forum(request, slug):
    """
	Displays a list of threads within a forum.
	Threads are sorted by their sticky flag, followed by their 
	most recent post.
	"""
    f = get_object_or_404(Forum, slug=slug)

    inputform = create_newthreadform(request)
    extra = get_latest_news()
    extra["forum"] = f
    extra["form"] = inputform
    extra["form_action"] = "new/"
    extra["threads"] = f.thread_set.all().order_by("thread_latest_post")

    return render_to_response("community/thread_list.html", RequestContext(request, extra))
Exemplo n.º 33
0
def forum(request, slug):
 	"""
 	Displays a list of threads within a forum.
 	Threads are sorted by their sticky flag, followed by their 
 	most recent post.
 	"""
 	f = get_object_or_404(Forum, slug=slug)
 	inputform = create_newthreadform(request)
 	extra= get_latest_news()
 	extra['forum']=f
 	extra['form']=inputform
 	extra['form_action']='new/'
 	extra['threads']=f.thread_set.all().order_by('thread_latest_post')

 	return render(request, 'community/thread_list.html',
 		{'context':  extra})
Exemplo n.º 34
0
def thread(request, forum, thread):
    """
	Increments the viewed count on a thread then displays the 
	posts for that thread, in chronological order.
	"""
    f = get_object_or_404(Forum, slug=forum)
    t = get_object_or_404(Thread, pk=thread)
    p = t.post_set.all().order_by("time")

    t.views += 1
    t.save()

    inputform = create_newpostform(request)
    extra = get_latest_news()
    extra["forum"] = f
    extra["form"] = inputform
    extra["thread"] = t
    extra["form_action"] = "reply/"

    return DetailView.as_view(
        request, paginate_by=10, queryset=p, template_name="community/thread.html", extra_context=extra
    )
Exemplo n.º 35
0
def thread(request, forum, thread):
    """
	Increments the viewed count on a thread then displays the 
	posts for that thread, in chronological order.
	"""
    f = get_object_or_404(Forum, slug=forum)
    t = get_object_or_404(Thread, pk=thread)
    p = t.post_set.all().order_by('time')

    t.views += 1
    t.save()

    inputform = create_newpostform(request)
    extra = get_latest_news()
    extra['forum'] = f
    extra['form'] = inputform
    extra['thread'] = t
    extra['form_action'] = 'reply/'

    return list_detail.object_list(request,
                                   paginate_by=10,
                                   queryset=p,
                                   template_name='community/thread.html',
                                   extra_context=extra)
Exemplo n.º 36
0
def thread(request, forum, thread):
	"""
	Increments the viewed count on a thread then displays the 
	posts for that thread, in chronological order.
	"""
	f = get_object_or_404(Forum, slug=forum)
	t = get_object_or_404(Thread, pk=thread)
	p = t.post_set.all().order_by('time')

	t.views += 1
	t.save()

	inputform = create_newpostform(request)
	extra= get_latest_news()
	extra['forum']=f
	extra['form']=inputform
	extra['thread']=t
	extra['form_action']='reply/'

	return list_detail.object_list(request,
			paginate_by=10,
			queryset=p,
			template_name='community/thread.html',
			extra_context=extra)
Exemplo n.º 37
0
 def get_context_data(self, **kwargs):
     context=super(SoftwareByTag, self).get_context_data(**kwargs)
     slug = self.kwargs['slug']
     tag = get_object_or_404(Tag, slug__exact=slug)
     context.update(get_latest_news({ 'tags': tag }))
     return context
Exemplo n.º 38
0
 def get_context_data(self, **kwargs):
     context=super(SoftwareByAuthor, self).get_context_data(**kwargs)
     slug = self.kwargs['slug']
     author = get_object_or_404(Author, slug__exact=slug)
     context.update(get_latest_news({ 'author' : author }))
     return context
Exemplo n.º 39
0
 def get_context_data(self, **kwargs):
     context=super(SoftwareByUser, self).get_context_data(**kwargs)
     username = self.kwargs['username']
     user = get_object_or_404(User, username__exact=username)
     context.update(get_latest_news({ 'username' : user.username }))
     return context
Exemplo n.º 40
0
 def get_context_data(self, **kwargs):
     context=super(SoftwareInJmlr, self).get_context_data(**kwargs)
     context.update(get_latest_news({ 'jmlr' : True }))
     return context
Exemplo n.º 41
0
def search_description(request, qs):
    if qs.count()==0:
        return render_to_response('software/software_list.html',
                get_latest_news({ 'search_term': qs }),RequestContext(request))
    else:
        pass #return ClassListView(Revision.objects.get_by_searchterm(q), get_latest_news({ 'search_term': q }))
Exemplo n.º 42
0
 def get_context_data(self, **kwargs):
     context=super(SoftwareBySubscription, self).get_context_data(**kwargs)
     context.update(get_latest_news())
     return context
Exemplo n.º 43
0
 def get_context_data(self, **kwargs):
     context=super(SoftwareByDownloads, self).get_context_data(**kwargs)
     context.update(get_latest_news())
     return context
Exemplo n.º 44
0
 def get_context_data(self, **kwargs):
     context=super(SoftwareByDataFormats, self).get_context_data(**kwargs)
     slug = self.kwargs['slug']
     dataformat = get_object_or_404(DataFormat, slug__exact=slug)
     context.update(get_latest_news({ 'dataformat' : dataformat }))
     return context
Exemplo n.º 45
0
 def get_context_data(self, **kwargs):
     context=super(SoftwareByOpSys, self).get_context_data(**kwargs)
     slug = self.kwargs['slug']
     opsys = get_object_or_404(OpSys, slug__exact=slug)
     context.update(get_latest_news({ 'opsys' : opsys }))
     return context
Exemplo n.º 46
0
from django.conf.urls.defaults import *
from blog.models import BlogItem
from blog.feeds import RssBlogFeed
from community.summary import get_latest_news

info_dict = {
    'queryset' : BlogItem.objects.all(),
    'date_field' : 'pub_date',
    'extra_context' : get_latest_news()
}


urlpatterns = patterns('django.views.generic.date_based',
   (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[A-Za-z0-9-_]+)/$', 'object_detail', dict(info_dict, slug_field='slug')),
   (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', 'archive_day', info_dict),
   (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', 'archive_month', info_dict),
   (r'^(?P<year>\d{4})/$', 'archive_year', info_dict),
   (r'^rss/latest/$', RssBlogFeed),
)
Exemplo n.º 47
0
 def get_context_data(self, **kwargs):
     context=super(MonthView, self).get_context_data(**kwargs)
     context.update(get_latest_news())
     return context
Exemplo n.º 48
0
 def get_context_data(self, **kwargs):
     return get_latest_news()