Re: [Mixins] - Order of the Mixins - Is it a bug?

2018-06-16 Thread Mike Dewhirst

On 16/06/2018 3:29 AM, Vinnicyus Gracindo wrote:
Hi. I beat my brains out trying to find out why my cbv was not working 
with LoginRequiredMixin.

I found the order of the mixins in the inheritance:
It works: class UserListView(LoginRequiredMixin, ListView)
Doesn't work: class UserListView(ListView, LoginRequiredMixin)

Is that how it was designed?


Yes. See ...

https://docs.djangoproject.com/en/1.11/topics/auth/default/#django.contrib.auth.mixins.LoginRequiredMixin

... where the LoginRequiredMixin is positioned ahead of the View class. 
Or in your case the ListView class. For success it relies on Python 
method resolution order (MRO) see ...


https://www.python.org/download/releases/2.3/mro/  (introduced in Python 
2.3)


You may be aware of http://ccbv.co.uk/ with its very comprehensive 
documentation of Django CBVs. Well worth a visit if you haven't seen it.


Mike


or is it a bug?

Thanks.
--
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 
https://groups.google.com/d/msgid/django-users/CAMjWKi9RFwDWSnNU%3Dv16-bXx%2BjEvMOfnVnWnhrnFnFzrWsMsyQ%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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 
https://groups.google.com/d/msgid/django-users/9e840556-2f34-f5bc-48f7-35f780e402a0%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


need help with Django regstration redux

2018-06-16 Thread Leela Sai Madhav Manne
Iam trying develop a web application. I am using Django registration redux 
package for registration.

when im try to access http://127.0.0.1:8000/accounts/register

it automatically redirecting to http://127.0.0.1:8000/accounts/profile/

Shows me following  

Using the URLconf defined in bookstore.urls, Django tried these URL 
patterns, in this order:

   1. ^store/
   2. ^accounts/ ^activate/complete/$ 
   [name='registration_activation_complete']
   3. ^accounts/ ^activate/resend/$ [name='registration_resend_activation']
   4. ^accounts/ ^activate/(?P\w+)/$ 
   [name='registration_activate']
   5. ^accounts/ ^register/complete/$ [name='registration_complete']
   6. ^accounts/ ^register/closed/$ [name='registration_disallowed']
   7. ^accounts/ ^register/$ [name='registration_register']
   8. ^accounts/ ^login/$ [name='auth_login']
   9. ^accounts/ ^logout/$ [name='auth_logout']
   10. ^accounts/ ^password/change/$ [name='auth_password_change']
   11. ^accounts/ ^password/change/done/$ [name='auth_password_change_done']
   12. ^accounts/ ^password/reset/$ [name='auth_password_reset']
   13. ^accounts/ ^password/reset/complete/$ 
   [name='auth_password_reset_complete']
   14. ^accounts/ ^password/reset/done/$ [name='auth_password_reset_done']
   15. ^accounts/ 
   ^password/reset/confirm/(?P[0-9A-Za-z_\-]+)/(?P.+)/$ 
   [name='auth_password_reset_confirm']
   16. ^admin/

The current path, accounts/profile/, didn't match any of these.



I m not sure why ? 



-- 
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 
https://groups.google.com/d/msgid/django-users/eb1870ad-f2b3-4f71-953a-0a2cc7a213ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error running Django tutorial

2018-06-16 Thread Mayank Bhatia
hello guys,

I am facing the same error while creating the views.

On Sunday, February 28, 2016 at 1:20:39 AM UTC+5:30, Mike Kipling wrote:
>
> I am working through the Django tutorial *Writing your first Django app, 
> part 1.*
> I am using Windows 10, python 3.5.1 and Django 1.9.2 .
>  
> In the *Write your first view* section:  
> after writing the polls/views.py and polls/urls.py files, 
> and modifying the manage/urls.py file, 
> and starting the server,
>  
> When I go to http://localhost:8000/polls/ in the browser I get the 
> following error:
>
> Page not found (404) 
> Request Method: GET 
> Request URL: http://localhost:8000/polls/
>
> Using the URLconf defined in mysite.urls, Django tried these URL 
> patterns, in this order:
>
>1. ^admin/
>
>  

> The current URL, polls/, didn't match any of these.
>

-- 
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 
https://groups.google.com/d/msgid/django-users/181281c9-ecb5-4e84-9627-ce0be18599fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problems with list_filter and date_hierarchy in django2.05

2018-06-16 Thread Mark Phillips
When I select 6/15/2018 in the date_hierarchy, the following query is run:

*SELECT* `memorabilia_document`.`document_id`,
`memorabilia_document`.`document_state`,
`memorabilia_document`.`documentType_id_id`,
`memorabilia_document`.`created`, `memorabilia_document`.`updated`,
`memorabilia_document`.`storage_file_name`,
`memorabilia_document`.`thumb_storage`,
`memorabilia_document`.`original_file_name`,
`memorabilia_document`.`computed_sha256`

 *FROM* `memorabilia_document` *WHERE* ((EXTRACT(*DAY* *FROM*
CONVERT_TZ(`memorabilia_document`.`created`,
'UTC', 'America/Phoenix')) = 15 *AND* EXTRACT(*MONTH* *FROM*
CONVERT_TZ(`memorabilia_document`.`created`,
'UTC', 'America/Phoenix')) = 6 *AND* `memorabilia_document`.`created`
*BETWEEN* '2018-01-01 07:00:00' *AND* '2019-01-01 06:59:59.99')
*OR* (`memorabilia_document`.`document_id`
= 0 *OR* `memorabilia_document`.`document_id` = 2
*OR*`memorabilia_document`.`document_id`
= 7 *OR* `memorabilia_document`.`document_id` = 6 *OR*
`memorabilia_document`.`document_id`
= 10 *OR*`memorabilia_document`.`document_id` = 19 *OR*
`memorabilia_document`.`document_id`
= 14 *OR* `memorabilia_document`.`document_id` = 8
*OR*`memorabilia_document`.`document_id`
= 15 *OR* `memorabilia_document`.`document_id` = 21 *OR*
`memorabilia_document`.`document_id`
= 18 *OR*`memorabilia_document`.`document_id` = 17 *OR*
`memorabilia_document`.`document_id`
= 2 *OR* `memorabilia_document`.`document_id` = 5
*OR*`memorabilia_document`.`document_id`
= 3 *OR* `memorabilia_document`.`document_id` = 4 *OR*
`memorabilia_document`.`document_id`
= 22 *OR*`memorabilia_document`.`document_id` = 7 *OR*
`memorabilia_document`.`document_id`
= 18 *OR* `memorabilia_document`.`document_id` = 17
*OR*`memorabilia_document`.`document_id`
= 2 *OR* `memorabilia_document`.`document_id` = 7 *OR*
`memorabilia_document`.`document_id`
= 18 *OR*`memorabilia_document`.`document_id` = 17 *OR*
`memorabilia_document`.`document_id`
= 2 *OR* `memorabilia_document`.`document_id` = 18
*OR*`memorabilia_document`.`document_id`
= 17 *OR* `memorabilia_document`.`document_id` = 7 *OR*
`memorabilia_document`.`document_id`
= 18 *OR*`memorabilia_document`.`document_id` = 17 *OR*
`memorabilia_document`.`document_id`
= 2 *OR* `memorabilia_document`.`document_id` = 17
*OR*`memorabilia_document`.`document_id`
= 17 *OR* `memorabilia_document`.`document_id` = 7 *OR*
`memorabilia_document`.`document_id`
= 18 *OR*`memorabilia_document`.`document_id` = 17 *OR*
`memorabilia_document`.`document_id`
= 2 *OR* `memorabilia_document`.`document_id` = 17
*OR*`memorabilia_document`.`document_id`
= 17 *OR* `memorabilia_document`.`document_id` = 17 *OR*
`memorabilia_document`.`document_id`
= 7 *OR*`memorabilia_document`.`document_id` = 6 *OR*
`memorabilia_document`.`document_id`
= 10 *OR* `memorabilia_document`.`document_id` = 19
*OR*`memorabilia_document`.`document_id`
= 14 *OR* `memorabilia_document`.`document_id` = 8 *OR*
`memorabilia_document`.`document_id`
= 15 *OR*`memorabilia_document`.`document_id` = 21 *OR*
`memorabilia_document`.`document_id`
= 18 *OR* `memorabilia_document`.`document_id` = 17
*OR*`memorabilia_document`.`document_id`
= 2 *OR* `memorabilia_document`.`document_id` = 5 *OR*
`memorabilia_document`.`document_id`
= 3 *OR*`memorabilia_document`.`document_id` = 4 *OR*
`memorabilia_document`.`document_id`
= 22)) *ORDER* *BY* `memorabilia_document`.`created` *ASC*,
`memorabilia_document`.`document_id` *DESC*

The first part up to the first OR finds the one document created on
6/15/2018, but all the rest of the OR clauses just select all the rest of
the documents in the database, so no matter what date I query, I get all
the documents in the database.

Any ideas on how to get date_hierarchy to work?

Thanks,

Mark

On Thu, Jun 14, 2018 at 6:17 PM, Mark Phillips 
wrote:

> After some further investigation, the generated by the date_hierarchy for
> the DocumentAdmin is, for example, http://localhost:
> 8098/admin/memorabilia/document/?created__day=25&
> created__month=5&created__year=2018. There are documents with a created
> date of May 25, 2018. However, the Document field created is a DateTime
> field, so the time is also part of the field. I also have USE_TZ = True in
> settings.py, and I updated mysql to use time zones as outlined in the
> django docs (https://docs.djangoproject.com/en/2.0/ref/databases/#
> mysql-time-zone-definitions and https://dev.mysql.com/doc/
> refman/8.0/en/mysql-tzinfo-to-sql.html).
>
> I am not sure of the time zone issue is a red herring or not. Anyone have
> a suggestion on how to debug the problem?
>
> Thanks!
>
> Mark
>
> On Thu, Jun 14, 2018 at 2:02 PM, Mark Phillips  > wrote:
>
>> I have two related models, Document and DocumentMetaData, and two
>> separate ModelAdmins (DocumentAdmin, DocumentMetaDataAdmin) where I can't
>> seem to get list_filter or date_hierarchy to work. All the other aspects of
>