Re: Multiple serializers

2015-12-14 Thread Bruno A.
Also having your models would be helpful.

On Saturday, 12 December 2015 02:21:07 UTC, Daniel Chimeno wrote:
>
> This question is more about DRF  than 
> Django itself, I haven't use it for a while so I can't answer you,
> but please, put the code in a proper format way or pastebin, and say the 
> version you are using both Django and DRF
> in order other people can answer you.
>
>
> El jueves, 10 de diciembre de 2015, 19:27:26 (UTC+1), miguel angel lopez 
> mendo escribió:
>>
>> i have this serializers 
>>
>> class ValuarCoche(serializers.ModelSerializer):
>> class Meta:
>> model = Valuacion
>> depth = 6
>> fields = ('coche','Precio_Venta','Precio_Compra')
>>
>> class CocheSerializer2(serializers.ModelSerializer):
>> valuacion = ValuarCoche(many=True)
>> class Meta:
>> model = Coche
>>
>>
>> fields = ('id', 'marca', 'modelo', 'version', 
>> 'estado','anio','timestamp','valuacion')
>>
>>
>> but don't work  i need that print 
>>
>>
>> {
>> "id": 3,
>> "marca": {
>> "id": 1,
>> "nombre": "Acura"
>> },
>> "modelo": {
>> "id": 1,
>> "nombre": "ILX"
>> },
>> "version": "a5",
>> "estado": "1",
>> "anio": 2015,
>> "timestamp": "2015-12-08T19:12:05.887126Z"
>>
>>  "Precio_Venta": 0,
>>
>> "Precio_Compra": 0
>>
>> },
>>
>>
>>
>> the error is the next 
>>
>>
>> 
>>
>

-- 
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/811a040b-6ad0-49a8-be5d-2e2981ff4e4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiple serializers

2015-12-14 Thread Mandeep Tondak
Hi,


I thing you have an error in you queryset.



On Mon, Dec 14, 2015 at 3:47 PM, Bruno A.  wrote:

> Also having your models would be helpful.
>
>
> On Saturday, 12 December 2015 02:21:07 UTC, Daniel Chimeno wrote:
>>
>> This question is more about DRF  than
>> Django itself, I haven't use it for a while so I can't answer you,
>> but please, put the code in a proper format way or pastebin, and say the
>> version you are using both Django and DRF
>> in order other people can answer you.
>>
>>
>> El jueves, 10 de diciembre de 2015, 19:27:26 (UTC+1), miguel angel lopez
>> mendo escribió:
>>>
>>> i have this serializers
>>>
>>> class ValuarCoche(serializers.ModelSerializer):
>>> class Meta:
>>> model = Valuacion
>>> depth = 6
>>> fields = ('coche','Precio_Venta','Precio_Compra')
>>>
>>> class CocheSerializer2(serializers.ModelSerializer):
>>> valuacion = ValuarCoche(many=True)
>>> class Meta:
>>> model = Coche
>>>
>>>
>>> fields = ('id', 'marca', 'modelo', 'version',
>>> 'estado','anio','timestamp','valuacion')
>>>
>>>
>>> but don't work  i need that print
>>>
>>>
>>> {
>>> "id": 3,
>>> "marca": {
>>> "id": 1,
>>> "nombre": "Acura"
>>> },
>>> "modelo": {
>>> "id": 1,
>>> "nombre": "ILX"
>>> },
>>> "version": "a5",
>>> "estado": "1",
>>> "anio": 2015,
>>> "timestamp": "2015-12-08T19:12:05.887126Z"
>>>
>>>  "Precio_Venta": 0,
>>>
>>> "Precio_Compra": 0
>>>
>>> },
>>>
>>>
>>>
>>> the error is the next
>>>
>>>
>>> 
>>>
>> --
> 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/811a040b-6ad0-49a8-be5d-2e2981ff4e4b%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Warm Regard:-*
*Mandeep Kumar*



-- 
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/CAJri7SShng2GOy7Byy9DQqoEe94XyJ0z%3DAqa3Ciz5_XVKG-Y4w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


application not recognized as URL namespace

2015-12-14 Thread Axel Rau
In my root url, I have:

url(r'^authentication/', include('authentication.urls')),

in authentication/urls.py, I have no app_name declared.

In a module in authentication, I have

from django.core.urlresolvers import reverse

from django.apps import apps
print('authentication installed? ' + 
str(apps.is_installed('authentication')))

reverse('authentication:password_change',urlconf='authentication.urls')
 
and receive
django.core.urlresolvers.NoReverseMatch: 'authentication' is not a 
registered namespace
while the above debug print gives
authentication installed? True 

What am I doing wrong here?

Please advice,
Axel
—
PGP-Key:29E99DD6  ☀ +49 160 9945 7889  ☀ computing @ chaos claudius

-- 
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/66EBCCB2-1E4F-48AE-B953-52FB2B827612%40Chaos1.DE.
For more options, visit https://groups.google.com/d/optout.


Re: application not recognized as URL namespace

2015-12-14 Thread knbk
Hi Axel,

An installed application and a registered URL namespace are two distinct 
concepts. A URL namespace can only be defined by setting the app_name 
attribute in your urlconf. In this case, you haven't set a URL namespace 
for your authentication app, so your urls are not namespaced.

Also, the urlconf parameter to reverse() should point to the root urlconf, 
not to the urlconf in which your current url is defined. Since it defaults 
to the root urlconf defined in your project, it's easiest to omit it in 
most cases. If you don't, and use 'authentication.urls' as your root 
urlconf, the generated url will miss the 'authentication/' part of your 
url. 

To reverse the password_change url, simply use this:

reverse('password_change')

Marten


On Monday, December 14, 2015 at 1:37:56 PM UTC+1, axel...@chaos1.de wrote:
>
> In my root url, I have: 
>
> url(r'^authentication/', include('authentication.urls')), 
>
> in authentication/urls.py, I have no app_name declared. 
>
> In a module in authentication, I have 
>
> from django.core.urlresolvers import reverse 
>
> from django.apps import apps 
> print('authentication installed? ' + 
> str(apps.is_installed('authentication'))) 
>
> 
> reverse('authentication:password_change',urlconf='authentication.urls') 
>
>   
> and receive 
> django.core.urlresolvers.NoReverseMatch: 'authentication' is not a 
> registered namespace 
> while the above debug print gives 
> authentication installed? True 
>
> What am I doing wrong here? 
>
> Please advice, 
> Axel 
> — 
> PGP-Key:29E99DD6  ☀ +49 160 9945 7889  ☀ computing @ chaos claudius 
>
>

-- 
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/fc585533-0cb4-4419-8944-b38cbf4b472c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: application not recognized as URL namespace

2015-12-14 Thread Axel Rau
Thanks for taking the time,


> Am 14.12.2015 um 14:06 schrieb knbk :
> 
> Hi Axel,
> 
> An installed application and a registered URL namespace are two distinct 
> concepts. A URL namespace can only be defined by setting the app_name 
> attribute in your urlconf. In this case, you haven’t set a URL namespace for 
> your authentication app, so your urls are not namespaced.
OK. (I misunderstood the 1.9 docu as this would be required only with instance 
namespaces).
> 
> Also, the urlconf parameter to reverse() should point to the root urlconf, 
> not to the urlconf in which your current url is defined. Since it defaults to 
> the root urlconf defined in your project, it's easiest to omit it in most 
> cases. If you don’t, and use 'authentication.urls' as your root urlconf, the 
> generated url will miss the 'authentication/' part of your url.
I understand.
>  
> 
> To reverse the password_change url, simply use this:
> 
> reverse(‚password_change')
Making both changes gives:
django.core.urlresolvers.NoReverseMatch: Reverse for 'password_change' 
with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

I then tried to reference the views directly instead of strings:

from . import views
reverse(views.password_change),

with views.py containing:

class PasswordChangeView(LoginRequiredMixin, AuthDecoratorsMixin, 
WithCurrentSiteMixin, FormView):
...

password_change = PasswordChangeView.as_view()

and got;

django.core.urlresolvers.NoReverseMatch: Reverse for 
'authentication.views.PasswordChangeView' with arguments '()' and keyword 
arguments '{}' not found. 0 pattern(s) tried: []

Axel


> 
> Marten
> 
> 
> On Monday, December 14, 2015 at 1:37:56 PM UTC+1, axel...@chaos1.de wrote:
> In my root url, I have: 
> 
> url(r'^authentication/', include('authentication.urls')), 
> 
> in authentication/urls.py, I have no app_name declared. 
> 
> In a module in authentication, I have 
> 
> from django.core.urlresolvers import reverse 
> 
> from django.apps import apps 
> print('authentication installed? ' + 
> str(apps.is_installed('authentication'))) 
> 
> 
> reverse('authentication:password_change',urlconf='authentication.urls') 
>   
> and receive 
> django.core.urlresolvers.NoReverseMatch: 'authentication' is not a 
> registered namespace 
> while the above debug print gives 
> authentication installed? True 
> 
> What am I doing wrong here? 
> 
> Please advice, 
> Axel 
> — 
> PGP-Key:29E99DD6  ☀ +49 160 9945 7889  ☀ computing @ chaos claudius 
> 
> 
> -- 
> 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/fc585533-0cb4-4419-8944-b38cbf4b472c%40googlegroups.com
>  
> .
> For more options, visit https://groups.google.com/d/optout 
> .

---
PGP-Key:29E99DD6  ☀ +49 160 9945 7889  ☀ computing @ chaos claudius

-- 
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/F7522E61-F53E-4781-B83D-B4D1D226DB73%40Chaos1.DE.
For more options, visit https://groups.google.com/d/optout.


Re: application not recognized as URL namespace

2015-12-14 Thread knbk
Could you show your full root urls.py and authentication/urls.py?

On Monday, December 14, 2015 at 3:22:14 PM UTC+1, axel...@chaos1.de wrote:
>
> Thanks for taking the time,
>
>
> Am 14.12.2015 um 14:06 schrieb knbk >:
>
> Hi Axel,
>
> An installed application and a registered URL namespace are two distinct 
> concepts. A URL namespace can only be defined by setting the app_name 
> attribute in your urlconf. In this case, you haven’t set a URL namespace 
> for your authentication app, so your urls are not namespaced.
>
> OK. (I misunderstood the 1.9 docu as this would be required only with 
> instance namespaces).
>
>
> Also, the urlconf parameter to reverse() should point to the root 
> urlconf, not to the urlconf in which your current url is defined. Since it 
> defaults to the root urlconf defined in your project, it's easiest to omit 
> it in most cases. If you don’t, and use 'authentication.urls' as your 
> root urlconf, the generated url will miss the 'authentication/' part of 
> your url.
>
> I understand.
>
>  
>
> To reverse the password_change url, simply use this:
>
> reverse(‚password_change')
>
> Making both changes gives:
> django.core.urlresolvers.NoReverseMatch: Reverse for 'password_change' 
> with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) 
> tried: []
>
> I then tried to reference the views directly instead of strings:
>
> from . import views
> reverse(views.password_change),
>
> with views.py containing:
>
> class PasswordChangeView(LoginRequiredMixin, AuthDecoratorsMixin, 
> WithCurrentSiteMixin, FormView):
> ...
> 
> password_change = PasswordChangeView.as_view()
>
> and got;
>
> django.core.urlresolvers.NoReverseMatch: Reverse for 
> 'authentication.views.PasswordChangeView' with arguments '()' and keyword 
> arguments '{}' not found. 0 pattern(s) tried: []
>
> Axel
>
>
>
> Marten
>
>
> On Monday, December 14, 2015 at 1:37:56 PM UTC+1, axel...@chaos1.de wrote:
>>
>> In my root url, I have: 
>>
>> url(r'^authentication/', include('authentication.urls')), 
>>
>> in authentication/urls.py, I have no app_name declared. 
>>
>> In a module in authentication, I have 
>>
>> from django.core.urlresolvers import reverse 
>>
>> from django.apps import apps 
>> print('authentication installed? ' + 
>> str(apps.is_installed('authentication'))) 
>>
>>
>> 
>> reverse('authentication:password_change',urlconf='authentication.urls') 
>>
>>   
>> and receive 
>> django.core.urlresolvers.NoReverseMatch: 'authentication' is not 
>> a registered namespace 
>> while the above debug print gives 
>> authentication installed? True 
>>
>> What am I doing wrong here? 
>>
>> Please advice, 
>> Axel 
>> — 
>> PGP-Key:29E99DD6  ☀ +49 160 9945 7889  ☀ computing @ chaos claudius 
>>
>>
> -- 
> 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...@googlegroups.com .
> To post to this group, send email to django...@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/fc585533-0cb4-4419-8944-b38cbf4b472c%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> ---
> PGP-Key:29E99DD6  ☀ +49 160 9945 7889  ☀ computing @ chaos claudius
>
>

-- 
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/e8700750-d783-4636-926e-6a73c2fb6f6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django for Data Tables to group by when coloumn hidden

2015-12-14 Thread Sid
Thanks for your reply Carsten. I want to use javascript...I will try to put 
my question on data-tables as per your suggestion .

But thanks again for your reply :)


On Wednesday, December 9, 2015 at 10:07:16 AM UTC-5, Sid wrote:
>
> *Question:* I have a Data table displaying on django , but now I like to 
> group by when ever I will hide the column.
>
>
> *column1 column2 column3*
>
> AAACAD25
>
> AAAUSD12
>
> BBBCAD13
>
> BBBUSD16
>
> CCCCAD11
>
> CCCUSD18
>
>
> The above table will be displayed on web page using Django, now when ever 
> I hide *column2* It should group by and display like below table.
>
>
> *column1* *column3*
>
> AAA  37
>
> BBB  29
>
> CCC  39
>
>
> when ever I unhide it again it should display same as first table again.
>
> *can anyone tell me there is any possible way to do it.*
>
>
> Thanks in advance.
>

-- 
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/af456df2-a0c7-4904-84b5-2dc03d4a432b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: application not recognized as URL namespace

2015-12-14 Thread Axel Rau

> Am 14.12.2015 um 15:29 schrieb knbk :
> 
> Could you show your full root urls.py and authentication/urls.py?

urls.py:

from django.conf.urls import include, url
from django.views.generic import TemplateView

# Uncomment the next two lines to enable the admin:
from django.contrib import admin

urlpatterns = (
url(r'^$', TemplateView.as_view(template_name='base.html')),
url(r'^authentication/', include('authentication.urls')),
url(r'^admin/', include(admin.site.urls)),
)

if settings.DEBUG:
import debug_toolbar
urlpatterns += (url(r'^__debug__/', include(debug_toolbar.urls)),)

authentication/urls.py:

from django.conf.urls import url
from . import views

app_name = 'authentication'

urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^login/$', views.login, name='login'),
url(r'^loggedin/$', views.loggedin, name='loggedin'),
url(r'^logout/$', views.logout, name='logout'),
url(r'^password/$', views.password, name='password'),
url(r'^password_change/$', views.password_change, name='password_change'),
url(r'^password_change/done/$', views.password_change_done, 
name='password_change_done'),
url(r'^password_reset/$', views.password_reset, name='password_reset'),
url(r'^password_reset/done/$', views.password_reset_done, 
name='password_reset_done'),
url(r'^reset/done/$', views.password_reset_complete, 
name='password_reset_complete'),

url(r'^reset/(?P[0-9A-Za-z]{1,13})-(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
views.password_reset_confirm,
name='password_reset_confirm'),
url(r'^profile/$', views.profile, name='profile')
]

Axel

> 
> On Monday, December 14, 2015 at 3:22:14 PM UTC+1, axel...@chaos1.de wrote:
> Thanks for taking the time,
> 
> 
>> Am 14.12.2015 um 14:06 schrieb knbk >:
>> 
>> Hi Axel,
>> 
>> An installed application and a registered URL namespace are two distinct 
>> concepts. A URL namespace can only be defined by setting the app_name 
>> attribute in your urlconf. In this case, you haven’t set a URL namespace for 
>> your authentication app, so your urls are not namespaced.
> OK. (I misunderstood the 1.9 docu as this would be required only with 
> instance namespaces).
>> 
>> Also, the urlconf parameter to reverse() should point to the root urlconf, 
>> not to the urlconf in which your current url is defined. Since it defaults 
>> to the root urlconf defined in your project, it's easiest to omit it in most 
>> cases. If you don’t, and use 'authentication.urls' as your root urlconf, the 
>> generated url will miss the 'authentication/' part of your url.
> I understand.
>>  
>> 
>> To reverse the password_change url, simply use this:
>> 
>> reverse(‚password_change')
> Making both changes gives:
>   django.core.urlresolvers.NoReverseMatch: Reverse for 'password_change' 
> with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: 
> []
> 
> I then tried to reference the views directly instead of strings:
> 
>   from . import views
>   reverse(views.password_change),
> 
> with views.py containing:
> 
> class PasswordChangeView(LoginRequiredMixin, AuthDecoratorsMixin, 
> WithCurrentSiteMixin, FormView):
> ...
> 
> password_change = PasswordChangeView.as_view()
> 
> and got;
> 
>   django.core.urlresolvers.NoReverseMatch: Reverse for 
> 'authentication.views.PasswordChangeView' with arguments '()' and keyword 
> arguments '{}' not found. 0 pattern(s) tried: []
> 
> Axel
> 
> 
>> 
>> Marten
>> 
>> 
>> On Monday, December 14, 2015 at 1:37:56 PM UTC+1, axel...@chaos1.de wrote:
>> In my root url, I have: 
>> 
>> url(r'^authentication/', include('authentication.urls')), 
>> 
>> in authentication/urls.py, I have no app_name declared. 
>> 
>> In a module in authentication, I have 
>> 
>> from django.core.urlresolvers import reverse 
>> 
>> from django.apps import apps 
>> print('authentication installed? ' + str(apps.is 
>> _installed('authentication'))) 
>> 
>> 
>> reverse('authentication:password_change',urlconf='authentication.urls') 
>>   
>> and receive 
>> django.core.urlresolvers.NoReverseMatch: 'authentication' is not a 
>> registered namespace 
>> while the above debug print gives 
>> authentication installed? True 
>> 
>> What am I doing wrong here? 
>> 
>> Please advice, 
>> Axel 
>> — 
>> PGP-Key:29E99DD6  ☀ +49 160 9945 7889  ☀ computing @ chaos claudius 
>> 
>> 
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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

Re: application not recognized as URL namespace

2015-12-14 Thread knbk

>
> authentication/urls.py:
>
 

from django.conf.urls import url
> from . import views
>
 

app_name = 'authentication'
>

I thought you didn't have an app_name, but you do have one. In that case, 
the only problem was that you passed the wrong urlconf to reverse(). You 
should be able to reverse the url with:

reverse('authentication:password_change')



On Monday, December 14, 2015 at 3:53:24 PM UTC+1, axel...@chaos1.de wrote:
>
>
> Am 14.12.2015 um 15:29 schrieb knbk >:
>
> Could you show your full root urls.py and authentication/urls.py?
>
>
> urls.py:
>
> from django.conf.urls import include, url
> from django.views.generic import TemplateView
>
> # Uncomment the next two lines to enable the admin:
> from django.contrib import admin
>
> urlpatterns = (
> url(r'^$', TemplateView.as_view(template_name='base.html')),
> url(r'^authentication/', include('authentication.urls')),
> url(r'^admin/', include(admin.site.urls)),
> )
>
> if settings.DEBUG:
> import debug_toolbar
> urlpatterns += (url(r'^__debug__/', include(debug_toolbar.urls)),)
>
> authentication/urls.py:
>
> from django.conf.urls import url
> from . import views
>
> app_name = 'authentication'
>
> urlpatterns = [
> url(r'^$', views.index, name='index'),
> url(r'^login/$', views.login, name='login'),
> url(r'^loggedin/$', views.loggedin, name='loggedin'),
> url(r'^logout/$', views.logout, name='logout'),
> url(r'^password/$', views.password, name='password'),
> url(r'^password_change/$', views.password_change, 
> name='password_change'),
> url(r'^password_change/done/$', views.password_change_done, 
> name='password_change_done'),
> url(r'^password_reset/$', views.password_reset, name='password_reset'),
> url(r'^password_reset/done/$', views.password_reset_done, 
> name='password_reset_done'),
> url(r'^reset/done/$', views.password_reset_complete, 
> name='password_reset_complete'),
> 
> url(r'^reset/(?P[0-9A-Za-z]{1,13})-(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
> views.password_reset_confirm,
> name='password_reset_confirm'),
> url(r'^profile/$', views.profile, name='profile')
> ]
>
> Axel
>
>
> On Monday, December 14, 2015 at 3:22:14 PM UTC+1, axel...@chaos1.de wrote:
>>
>> Thanks for taking the time,
>>
>>
>> Am 14.12.2015 um 14:06 schrieb knbk :
>>
>> Hi Axel,
>>
>> An installed application and a registered URL namespace are two distinct 
>> concepts. A URL namespace can only be defined by setting the app_name 
>> attribute in your urlconf. In this case, you haven’t set a URL namespace 
>> for your authentication app, so your urls are not namespaced.
>>
>> OK. (I misunderstood the 1.9 docu as this would be required only with 
>> instance namespaces).
>>
>>
>> Also, the urlconf parameter to reverse() should point to the root 
>> urlconf, not to the urlconf in which your current url is defined. Since it 
>> defaults to the root urlconf defined in your project, it's easiest to omit 
>> it in most cases. If you don’t, and use 'authentication.urls' as your 
>> root urlconf, the generated url will miss the 'authentication/' part of 
>> your url.
>>
>> I understand.
>>
>>  
>>
>> To reverse the password_change url, simply use this:
>>
>> reverse(‚password_change')
>>
>> Making both changes gives:
>> django.core.urlresolvers.NoReverseMatch: Reverse for 'password_change' 
>> with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) 
>> tried: []
>>
>> I then tried to reference the views directly instead of strings:
>>
>> from . import views
>> reverse(views.password_change),
>>
>> with views.py containing:
>>
>> class PasswordChangeView(LoginRequiredMixin, AuthDecoratorsMixin, 
>> WithCurrentSiteMixin, FormView):
>> ...
>> 
>> password_change = PasswordChangeView.as_view()
>>
>> and got;
>>
>> django.core.urlresolvers.NoReverseMatch: Reverse for 
>> 'authentication.views.PasswordChangeView' with arguments '()' and keyword 
>> arguments '{}' not found. 0 pattern(s) tried: []
>>
>> Axel
>>
>>
>>
>> Marten
>>
>>
>> On Monday, December 14, 2015 at 1:37:56 PM UTC+1, axel...@chaos1.de wrote:
>>>
>>> In my root url, I have: 
>>>
>>> url(r'^authentication/', include('authentication.urls')), 
>>>
>>> in authentication/urls.py, I have no app_name declared. 
>>>
>>> In a module in authentication, I have 
>>>
>>> from django.core.urlresolvers import reverse 
>>>
>>> from django.apps import apps 
>>> print('authentication installed? ' + 
>>> str(apps.is_installed('authentication'))) 
>>>
>>>
>>> 
>>> reverse('authentication:password_change',urlconf='authentication.urls') 
>>>
>>>   
>>> and receive 
>>> django.core.urlresolvers.NoReverseMatch: 'authentication' is not 
>>> a registered namespace 
>>> while the above debug print gives 
>>> authentication installed? True 
>>>
>>> What am I doing wrong here? 
>>>
>>> Please advice, 
>>> Axel 
>>> — 
>>> PGP-Key:29E99DD6  ☀ +49 160 994

Re: application not recognized as URL namespace

2015-12-14 Thread Axel Rau

> Am 14.12.2015 um 16:03 schrieb knbk :
> 
> authentication/urls.py:
>  
> from django.conf.urls import url
> from . import views
>  
> app_name = 'authentication'
> 
> I thought you didn’t have an app_name, but you do have one.
I changed this after your advice.

> In that case, the only problem was that you passed the wrong urlconf to 
> reverse(). You should be able to reverse the url with:
> 
> reverse('authentication:password_change')
> 
I did not try this combination, but it works!  Thanks!

One last question:

Changing this to an instance namespace would just require in urls:

url(r'^auth/', include('authentication.urls', namespace='auth')),

and where I reverse:

reverse(’auth:password_change’)

right?

But this again gives:

django.core.urlresolvers.NoReverseMatch: 'auth' is not a registered namespace

> 
> 
> On Monday, December 14, 2015 at 3:53:24 PM UTC+1, axel...@chaos1.de wrote:
> 
>> Am 14.12.2015 um 15:29 schrieb knbk >:
>> 
>> Could you show your full root urls.py and authentication/urls.py?
> 
> urls.py:
> 
> from django.conf.urls import include, url
> from django.views.generic import TemplateView
> 
> # Uncomment the next two lines to enable the admin:
> from django.contrib import admin
> 
> urlpatterns = (
> url(r'^$', TemplateView.as_view(template_name='base.html')),
> url(r'^authentication/', include('authentication.urls')),
> url(r'^admin/', include(admin.site.urls)),
> )
> 
> if settings.DEBUG:
> import debug_toolbar
> urlpatterns += (url(r'^__debug__/', include(debug_toolbar.urls)),)
> 
> authentication/urls.py:
> 
> from django.conf.urls import url
> from . import views
> 
> app_name = 'authentication'
> 
> urlpatterns = [
> url(r'^$', views.index, name='index'),
> url(r'^login/$', views.login, name='login'),
> url(r'^loggedin/$', views.loggedin, name='loggedin'),
> url(r'^logout/$', views.logout, name='logout'),
> url(r'^password/$', views.password, name='password'),
> url(r'^password_change/$', views.password_change, name='password_change'),
> url(r'^password_change/done/$', views.password_change_done, 
> name='password_change_done'),
> url(r'^password_reset/$', views.password_reset, name='password_reset'),
> url(r'^password_reset/done/$', views.password_reset_done, 
> name='password_reset_done'),
> url(r'^reset/done/$', views.password_reset_complete, 
> name='password_reset_complete'),
> 
> url(r'^reset/(?P[0-9A-Za-z]{1,13})-(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
> views.password_reset_confirm,
> name='password_reset_confirm'),
> url(r'^profile/$', views.profile, name='profile')
> ]
> 
> Axel
> 
>> 
>> On Monday, December 14, 2015 at 3:22:14 PM UTC+1, axel...@chaos1.de wrote:
>> Thanks for taking the time,
>> 
>> 
>>> Am 14.12.2015 um 14:06 schrieb knbk >:
>>> 
>>> Hi Axel,
>>> 
>>> An installed application and a registered URL namespace are two distinct 
>>> concepts. A URL namespace can only be defined by setting the app_name 
>>> attribute in your urlconf. In this case, you haven’t set a URL namespace 
>>> for your authentication app, so your urls are not namespaced.
>> OK. (I misunderstood the 1.9 docu as this would be required only with 
>> instance namespaces).
>>> 
>>> Also, the urlconf parameter to reverse() should point to the root urlconf, 
>>> not to the urlconf in which your current url is defined. Since it defaults 
>>> to the root urlconf defined in your project, it's easiest to omit it in 
>>> most cases. If you don’t, and use 'authentication.urls' as your root 
>>> urlconf, the generated url will miss the 'authentication/' part of your url.
>> I understand.
>>>  
>>> 
>>> To reverse the password_change url, simply use this:
>>> 
>>> reverse(‚password_change')
>> Making both changes gives:
>>  django.core.urlresolvers.NoReverseMatch: Reverse for 'password_change' 
>> with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) 
>> tried: []
>> 
>> I then tried to reference the views directly instead of strings:
>> 
>>  from . import views
>>  reverse(views.password_change),
>> 
>> with views.py containing:
>> 
>> class PasswordChangeView(LoginRequiredMixin, AuthDecoratorsMixin, 
>> WithCurrentSiteMixin, FormView):
>> ...
>> 
>> password_change = PasswordChangeView.as_view()
>> 
>> and got;
>> 
>>  django.core.urlresolvers.NoReverseMatch: Reverse for 
>> 'authentication.views.PasswordChangeView' with arguments '()' and keyword 
>> arguments '{}' not found. 0 pattern(s) tried: []
>> 
>> Axel
>> 
>> 
>>> 
>>> Marten
>>> 
>>> 
>>> On Monday, December 14, 2015 at 1:37:56 PM UTC+1, axel...@chaos1.de wrote:
>>> In my root url, I have: 
>>> 
>>> url(r'^authentication/', include('authentication.urls')), 
>>> 
>>> in authentication/urls.py, I have no app_name declared. 
>>> 
>>> In a module in authentication, I have 
>>> 
>>> from django.core.urlresolvers import reverse 
>>> 
>>> from django.apps import a

[RESOLVED] --was: Re: application not recognized as URL namespace

2015-12-14 Thread Axel Rau
I see my error: ’auth’ is already an appname (django.contrib.auth).
Using ’accnt’ works perfectly!

Thanks, again, Axel

> Am 14.12.2015 um 16:32 schrieb Axel Rau :
> 
> 
>> Am 14.12.2015 um 16:03 schrieb knbk > >:
>> 
>> authentication/urls.py:
>>  
>> from django.conf.urls import url
>> from . import views
>>  
>> app_name = 'authentication'
>> 
>> I thought you didn’t have an app_name, but you do have one.
> I changed this after your advice.
> 
>> In that case, the only problem was that you passed the wrong urlconf to 
>> reverse(). You should be able to reverse the url with:
>> 
>> reverse('authentication:password_change')
>> 
> I did not try this combination, but it works!  Thanks!
> 
> One last question:
> 
> Changing this to an instance namespace would just require in urls:
> 
> url(r'^auth/', include('authentication.urls', namespace='auth')),
> 
> and where I reverse:
> 
> reverse(’auth:password_change’)
> 
> right?
> 
> But this again gives:
> 
> django.core.urlresolvers.NoReverseMatch: 'auth' is not a registered namespace
> 
>> 
>> 
>> On Monday, December 14, 2015 at 3:53:24 PM UTC+1, axel...@chaos1.de wrote:
>> 
>>> Am 14.12.2015 um 15:29 schrieb knbk >:
>>> 
>>> Could you show your full root urls.py and authentication/urls.py?
>> 
>> urls.py:
>> 
>> from django.conf.urls import include, url
>> from django.views.generic import TemplateView
>> 
>> # Uncomment the next two lines to enable the admin:
>> from django.contrib import admin
>> 
>> urlpatterns = (
>> url(r'^$', TemplateView.as_view(template_name='base.html')),
>> url(r'^authentication/', include('authentication.urls')),
>> url(r'^admin/', include(admin.site.urls)),
>> )
>> 
>> if settings.DEBUG:
>> import debug_toolbar
>> urlpatterns += (url(r'^__debug__/', include(debug_toolbar.urls)),)
>> 
>> authentication/urls.py:
>> 
>> from django.conf.urls import url
>> from . import views
>> 
>> app_name = 'authentication'
>> 
>> urlpatterns = [
>> url(r'^$', views.index, name='index'),
>> url(r'^login/$', views.login, name='login'),
>> url(r'^loggedin/$', views.loggedin, name='loggedin'),
>> url(r'^logout/$', views.logout, name='logout'),
>> url(r'^password/$', views.password, name='password'),
>> url(r'^password_change/$', views.password_change, 
>> name='password_change'),
>> url(r'^password_change/done/$', views.password_change_done, 
>> name='password_change_done'),
>> url(r'^password_reset/$', views.password_reset, name='password_reset'),
>> url(r'^password_reset/done/$', views.password_reset_done, 
>> name='password_reset_done'),
>> url(r'^reset/done/$', views.password_reset_complete, 
>> name='password_reset_complete'),
>> 
>> url(r'^reset/(?P[0-9A-Za-z]{1,13})-(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
>> views.password_reset_confirm,
>> name='password_reset_confirm'),
>> url(r'^profile/$', views.profile, name='profile')
>> ]
>> 
>> Axel
>> 
>>> 
>>> On Monday, December 14, 2015 at 3:22:14 PM UTC+1, axel...@chaos1.de wrote:
>>> Thanks for taking the time,
>>> 
>>> 
 Am 14.12.2015 um 14:06 schrieb knbk >:
 
 Hi Axel,
 
 An installed application and a registered URL namespace are two distinct 
 concepts. A URL namespace can only be defined by setting the app_name 
 attribute in your urlconf. In this case, you haven’t set a URL namespace 
 for your authentication app, so your urls are not namespaced.
>>> OK. (I misunderstood the 1.9 docu as this would be required only with 
>>> instance namespaces).
 
 Also, the urlconf parameter to reverse() should point to the root urlconf, 
 not to the urlconf in which your current url is defined. Since it defaults 
 to the root urlconf defined in your project, it's easiest to omit it in 
 most cases. If you don’t, and use 'authentication.urls' as your root 
 urlconf, the generated url will miss the 'authentication/' part of your 
 url.
>>> I understand.
  
 
 To reverse the password_change url, simply use this:
 
 reverse(‚password_change')
>>> Making both changes gives:
>>> django.core.urlresolvers.NoReverseMatch: Reverse for 'password_change' 
>>> with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) 
>>> tried: []
>>> 
>>> I then tried to reference the views directly instead of strings:
>>> 
>>> from . import views
>>> reverse(views.password_change),
>>> 
>>> with views.py containing:
>>> 
>>> class PasswordChangeView(LoginRequiredMixin, AuthDecoratorsMixin, 
>>> WithCurrentSiteMixin, FormView):
>>> ...
>>> 
>>> password_change = PasswordChangeView.as_view()
>>> 
>>> and got;
>>> 
>>> django.core.urlresolvers.NoReverseMatch: Reverse for 
>>> 'authentication.views.PasswordChangeView' with arguments '()' and keyword 
>>> arguments '{}' not found. 0 pattern(s) tried: []
>>> 
>>> Axel
>>> 
>>> 
 
 Marten
 
 
 On Monday, Decem

Re: calling html file from within javascript

2015-12-14 Thread Gary Roach

Hi Gergely

I agree that document.write is a bad idea. Freezing in this case may be 
a poor choice of words. I was trying to convey that the code executes OK 
until it gets to the .write line and hangs up. It never completes the 
.write line.


As for purpose. Main.html is a template contains the permanent headers 
and footers for the site with the body consisting of an iframe 
containing a {% block content %} {% endblock %} statement. When each 
button is pushed, all buttons are disabled and the .html template file 
associated  with the particular button is used to fill the block 
content. This worked when I didn't use javascript to call welcome.html. 
But I can't seem to figure out how to serve up the file with javascript. 
I really don't want to change the general method. I have never liked web 
sites that allow users to hit the same button twice or hit more than one 
button in mid load. I know that one can build buttons using link but 
this seemed more straight forward to me. ie have the  button call a 
javescript function and let the function do all of the heavy lifting.


I've had many years of various levels of programming and system 
maintenance but have been retired since 1998 and am pretty rusty. In 
addition, the technology has shifted significantly since. So for all 
practical purposes I'm an nooby and am trying to master python, html, 
javascript and django all at the same time. Learning by doing I guess.


So the bottom line is that I need a code snippet to put under case b1 
that will insert welcome.html into the block statement in main.html.


Any help will be sincerely appreciated.

Gary R.

On 12/13/2015 10:55 PM, Gergely Polonkai wrote:


Sorry, I have pressed Send too soon…

As you see, using document.write is a very bad idea. However, freezing 
is not mentioned in that document. What does freezing mean in this 
case? Are you sure it's this code that gets executed and freezes?


Also, what exactly do you want to achieve?

Best,
Gergely

On Dec 14, 2015 7:52 AM, "Gergely Polonkai" > wrote:


Hello,

although this is barelyDjango related, here are some notes.

From MDN[1]: Note: as* document.write* writes to the document
*stream*, calling *document.write* on a closed (loaded) document
automatically calls*document.open* which will clear the document
.

[1] https://developer.mozilla.org/en-US/docs/Web/API/Document/write

On Dec 14, 2015 1:22 AM, "Gary Roach" mailto:gary719_li...@verizon.net>> wrote:

I use javascript in my  main.html (top template) to control
the access to several buttons. The buttons call a javascript
function. This setup works exactly as I wish except the
buttons still don't really do anything. I need to have each
button load a different template. The pertinent script is:


"use strict"
var bn = ""
function buttoncontrol(bn){
var i = 0;
var bx = "";
var x = []; /*array*/
if (bn=="resetDone")
{
for (var i = 0; i < 4; i++)
{
bx= "b" + (i+1);
document.getElementById(bx)
.removeAttribute("disabled");
}
return
}
else {
for (var i = 0; i < 4; i++)
{
bx= "b" + (i+1);
document.getElementById(bx)
.setAttribute("disabled", "true");
}
switch(bn) {
case "b1":
document.write("'welcome.html'>'Welcome.html'");
 break;
case "b2":
break;
case "b3":
break;
case "b4":
break;
default:
document.write("fell out the bottom");
}
return;
}
}



The code works till it hits the document.write statement and
freezes. This just plain doesn't work. What would. I want to
keep this approach, so I need an alternative to the 
document.write statement.


Both my main.html and my welcome.html are in t

Re: Tool to document project urls, views, templates, etc...

The closest I know is :

python manage.py show_urls

in the django-extensions package

On Saturday, December 12, 2015 at 9:43:28 AM UTC-4, Mat Gessel wrote:
>
> Anyone know of a tool that can analyze a project and generate a list or 
> graph of *views* & related information?
>
> I'm maintaining a medium size Django project. For each feature/change, I 
> am finding myself creating a "map" of the relevant view names/relationships 
> for quick reference. This includes:
>
>- URL pattern
>- URL pattern name
>- view class name
>- template file name
>
> Example:
>
>> /training/, course-list, TrainingCourseList, 
>> training/trainingcourse_list.html
>> /training/courses//, course-detail, TrainingCourseDetail, 
>> training/trainingcourse_detail.html
>> /training/courses//purchase/, course-cart, TrainingCourseCart, 
>> training/trainingcourse_cart.html
>> /training/checkout/, course-checkout, TrainingCourseCheckout, 
>> training/trainingcourse_checkout.html
>
>
> I'm new to Django and I like it so far, but identifying references is a 
> bit of a nuisance. I found manage.py graph_models, but that only 
> processes models.
>
> I lieu of a tool, anyone have organizational practices they'd like to 
> share?
>
> Thanks,
>
> -- 
> Mat Gessel
> http://www.asquare.net
>

-- 
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/ae250cf2-2fc8-41fe-857a-f64c1a8e56e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tool to document project urls, views, templates, etc...

http://ccbv.co.uk/ does this for django class based views. The code is on
github
https://github.com/refreshoxford/django-cbv-inspector/

Might be a good starting point.

D

On 14 December 2015 at 17:49, Royendgel Silberie 
wrote:

> The closest I know is :
>
> python manage.py show_urls
>
> in the django-extensions package
>
> On Saturday, December 12, 2015 at 9:43:28 AM UTC-4, Mat Gessel wrote:
>>
>> Anyone know of a tool that can analyze a project and generate a list or
>> graph of *views* & related information?
>>
>> I'm maintaining a medium size Django project. For each feature/change, I
>> am finding myself creating a "map" of the relevant view names/relationships
>> for quick reference. This includes:
>>
>>- URL pattern
>>- URL pattern name
>>- view class name
>>- template file name
>>
>> Example:
>>
>>> /training/, course-list, TrainingCourseList,
>>> training/trainingcourse_list.html
>>> /training/courses//, course-detail, TrainingCourseDetail,
>>> training/trainingcourse_detail.html
>>> /training/courses//purchase/, course-cart, TrainingCourseCart,
>>> training/trainingcourse_cart.html
>>> /training/checkout/, course-checkout, TrainingCourseCheckout,
>>> training/trainingcourse_checkout.html
>>
>>
>> I'm new to Django and I like it so far, but identifying references is a
>> bit of a nuisance. I found manage.py graph_models, but that only
>> processes models.
>>
>> I lieu of a tool, anyone have organizational practices they'd like to
>> share?
>>
>> Thanks,
>>
>> --
>> Mat Gessel
>> http://www.asquare.net
>>
> --
> 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/ae250cf2-2fc8-41fe-857a-f64c1a8e56e7%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Wildman and Herring Limited, Registered Office: 52 Great Eastern Street,
London, EC2A 3EP, Company no: 05766374

-- 
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/CAPZHCY7UKT5mHEw2%2BhhZ_xDZr6SnX2VmWYVAeYAWtDS%3DZBF3xw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django decision for tour reservation database


On Sunday, 13 December 2015 20:04:05 UTC+5:30, Tourmaster wrote:
>
> I want to put a single database on a server available to the office, 
> outside agents and customers who will reserve a seat, select upgrades, 
> agree to price and deposits and receive an email confirmation.
>
> Is this a job for a lighter framework?  Also, I may want to go mobile in 
> the future. 
>
>
No, that's too much. Better use anything heavier. Even if you think it's 
light, you already have a wordpress site and you're expanding, think how 
much expansion you would do to this site in future.

Django is just fine for mobile. It's the templates you have to look after. 
You can serve pages depending upon user agent. 

SQLite is used because people generally don't have ready data and they 
don't know what table/columns they would have. Since you already know the 
table structure & have data (in Access), you might as well start 
development with MySQL, bugs will be found at the outset.

-- 
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/0803d786-a3e9-467d-a2c9-a11ecbfff2eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.