Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9271285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:35:01+00:00 2026-06-18T15:35:01+00:00

i have a dayarchiveview in my django views.py file class day_archive(DayArchiveView): model=Timer paginate_by=12 allow_future

  • 0

i have a dayarchiveview in my django views.py file

class day_archive(DayArchiveView):
    model=Timer
    paginate_by=12
    allow_future =True
    allow_empty=True
    month_format = '%m'
    day_format='%d'
    date_field='start_hour'
    template_name='timer/timer_archive_date'

    def get_queryset(self):
        return Timer.objects.filter(author=self.request.user)

but i would like to render the data returned as a table using djangotables2 with something like this:

 import django_tables2 as tables

 class Job_table(tables.Table):
    class Meta: 
    model = Timer
    attrs = {"class": "paleblue"}
    fields= ('start_hour','end_hour','category','subcategory','duration')

    def render_duration(self,value):
        from timehuman import sectohour
        hh= sectohour(value)
        return hh

how would i render my data as a table instead of the list rendered? ( context object_list by django) how do i access the data thats going to be sent to the object_list context and modify it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:35:03+00:00Added an answer on June 18, 2026 at 3:35 pm

    This is what i ended up doing:
    may be hackish, but i gives me access to the same data that’s going to the view and i can get to render it as a table.

    class day_archive(DayArchiveView):
        model=Timer
        paginate_by=12
        allow_future =True
        allow_empty=True
        month_format = '%m'
        day_format='%d'
        date_field='begin_time'
        template_name='timer/timer_archive_date'
    
        def get_queryset(self):
            return Timer.objects.filter(author=self.request.user)
    
        def render_to_response(self, context, **response_kwargs):
            """
            Returns a response, using the `response_class` for this
            view, with a template rendered with the given context.
    
            If any keyword arguments are provided, they will be
            passed to the constructor of the response class.
            """
    
        tbl = context['object_list']  #this line is my hack, i dont know better.
        if (tb1 != None):
            jt = Timer_table(blo)
            RequestConfig(self.request).configure(jt)
            from django.db.models import Sum
            total = tbl.aggregate(Sum('duration'))
            t2 = total['duration__sum']
            if (t2 != None):
                timedel= str(datetime.timedelta(seconds=float(t2)))
                context['table']= jt
                context['total'] = timedel 
    
        return self.response_class(
            request = self.request,
            template = self.get_template_names(),
            context = context,
            **response_kwargs
        )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

have written this little class, which generates a UUID every time an object of
Have a test program public class Path { public static void main(String[] args) {
Have written all the code in a silverlight class library (dll) and linked this
Have a simple iPhone app with a single UIViewController and two Views in one
have a class structure like so Permit -> Financial ->ICollection instrumentList Instrument -> Agency
Have you ever tried working with a XAML file which contains thousand tons of
Have a singleton class for BNRItemStore, but when I tried to call it, I
Have defined such class: class Data { internal string f_source; internal string f_output; internal
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
Have done quite a bit of searching for a guide (of any substance) for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.