Hash: SHA512

Hi Gerald,

Couple of points:
- - please try to stick to the mailing list when posting follow-up
  questions or materials rather than replying off-list; this makes it
  possible for other people to jump in and offer their advice (and
  also doesn't send the message that you expect the one person who
  tried to help you to personally coach you through your issue), and
- - rather than attaching your code in a tarball, posting the relevant
  parts of your code in-line typically makes it easier for people to
  help you – I can just look at the email and directly see the code,
  rather than having to fetch the attachment, unpack it, and go
  through all that hassle. (And don't even get me started on the trend
  of posting screenshots of stack traces or even code; some of us are
  reading our mail in text-mode terminals. Get off my lawn, kids! :P )

With that out of the way, let's get back to your questions.

On Thu, Aug 09, 2018 at 09:15:36PM +0800, Gerald Brown wrote:
> Thanks for your info.
> I am attaching my views.py, url.py and index.html.  The index.html creates a
> menu on the main admin page.  I have included some comments there about the
> strange happenings that are going on.  I am not able to include any trace
> info because I have gone back to my original program from before these
> generic date views.
> The URLS1.py file is from my top level and URL.py is from my visit app. In
> the views.py file most of the code is formatting the reportlab pdf file with
> the data from the queryset assigned to various locations in the pdf.


    from django.contrib import admin
    from django.urls import include, path

    #from visit import views # as visit_views
    from visit.views import PaymentTodayArchiveView 

    urlpatterns = [
            path('today/', PaymentTodayArchiveView.as_view, name="today"),


    from django.contrib.admin.sites import AdminSite
    from django.contrib import admin
    from django.urls import path
    from django.conf.urls import include, url
    #from django.views.generic.dates import DateDetailView

    from patient import views as patient_views
    from visit import views as visit_views

    admin.site.site_header = 'MEDREC Administration'

    class DashboardSite(AdminSite):
            def get_urls(self):
                    urls = super(DashboardSite, self).get_urls()
                    custom_urls = [
                            path('^$', self.admin_view(HomeView.as_view()), 
                    del urls[2]
                    return custom_urls + urls

    urlpatterns = [
            path('admin/patient/', patient_views.prescription_view),
            path('admin/visit/', visit_views.daily_payment_view),
            path('admin/', admin.site.urls),


    # ~ class PaymentTodayArchiveView(TodayArchiveView):
            # ~ queryset = Visit.objects.all()
            # ~ date_field = "visit_date"

So, starting from the beginning – the correct way to reference a
generic class-based view in an URL config is to use
MyViewClass.as_view() – note the parentheses. You can see that in
action in the custom AdminSite that you wrote. The parentheses are
missing in your urls.py.

Second, I don't see urls.py being referenced anywhere in urls1.py,
which you say is the root URL config.

Third, your usage of the ``staff_member_required`` decorator is not
correct – I recommend reading the section of the docs which covers
decorating class-based views [1] to learn how to do that. Not to
mention that you left the decorator in place, while you commented out
the view itself, which means the decorator would get applied to the
next definition following it.

I'm not quite sure how I can help you here, since you don't actually
have any code in place that would use the GCBV...

> It seems like all tutorials I try to follow they are only half complete and
> they leave out a lot of stuff..like how to access these views.  Maybe that
> is something I should know, but don't.
> As it is getting late here I will be taking another look at this tomorrow.


Version: GnuPG v1


You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to