示例#1
0
文件: list.py 项目: 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 }),
                                   )
示例#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}),
        )
示例#3
0
文件: views.py 项目: kidzik/mloss
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()))
示例#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()})
示例#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()})
示例#6
0
文件: views.py 项目: mindcrime/mloss
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()))
示例#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(),
                                   )
示例#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(),
                                   )
示例#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(),
                                   )
示例#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')
示例#11
0
文件: list.py 项目: bairuiworld/mloss
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'
                                   )
示例#12
0
文件: list.py 项目: bairuiworld/mloss
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'
                                   )
示例#13
0
文件: list.py 项目: bairuiworld/mloss
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',
                                   )
示例#14
0
文件: list.py 项目: bairuiworld/mloss
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',
                                   )
示例#15
0
文件: list.py 项目: bairuiworld/mloss
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',
                                   )
示例#16
0
文件: list.py 项目: bairuiworld/mloss
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',
                                   )
示例#17
0
文件: list.py 项目: bairuiworld/mloss
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',
                                   )
示例#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')
示例#19
0
文件: list.py 项目: bairuiworld/mloss
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(),
                                   )
示例#20
0
文件: list.py 项目: bairuiworld/mloss
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(),
                                   )
示例#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',
    )
示例#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(),
    )
示例#23
0
文件: list.py 项目: 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(),
                                   )
示例#24
0
文件: list.py 项目: bairuiworld/mloss
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(),
                                   )
示例#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',
    )
示例#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',
    )
示例#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',
    )
示例#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',
    )
示例#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(),
    )
示例#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})
示例#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(),
    )
示例#32
0
文件: views.py 项目: kidzik/mloss
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))
示例#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})
示例#34
0
文件: views.py 项目: kidzik/mloss
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
    )
示例#35
0
文件: views.py 项目: mindcrime/mloss
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)
示例#36
0
文件: views.py 项目: Afelio/mloss
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)
示例#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
示例#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
示例#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
示例#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
示例#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 }))
示例#42
0
 def get_context_data(self, **kwargs):
     context=super(SoftwareBySubscription, self).get_context_data(**kwargs)
     context.update(get_latest_news())
     return context
示例#43
0
 def get_context_data(self, **kwargs):
     context=super(SoftwareByDownloads, self).get_context_data(**kwargs)
     context.update(get_latest_news())
     return context
示例#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
示例#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
示例#46
0
文件: urls.py 项目: mindcrime/mloss
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),
)
示例#47
0
 def get_context_data(self, **kwargs):
     context=super(MonthView, self).get_context_data(**kwargs)
     context.update(get_latest_news())
     return context
示例#48
0
 def get_context_data(self, **kwargs):
     return get_latest_news()