Re: What's the new "field" parameter in the ManyToOneRel __init__ function?

2013-09-06 Thread Mark Young
For a little bit of context, here's an example of code that perviously 
worked but now doesn't:

class CategoryAdminForm(forms.ModelForm):
"""Form for Category's Admin"""
parent = TreeNodeChoiceField(
label=_('Parent category'),
level_indicator='|--', required=False,
empty_label=_('No parent category'),
queryset=Category.objects.all())

def __init__(self, *args, **kwargs):
super(CategoryAdminForm, self).__init__(*args, **kwargs)
rel = ManyToOneRel(Category, 'id')
self.fields['parent'].widget = RelatedFieldWidgetWrapper(
self.fields['parent'].widget, rel, self.admin_site)

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: What is the best way to have multiple admin users with there own models?

2013-09-06 Thread Robert Steckroth
Ok, this question was typed in haste, my mistake. What I needed was an
admin section for individual clients which could populate within the same
database.
By using separate admins, I was able to provide a superuser the ability to
designate which database section he/she would have access to with a cool
url to that database.
i.e. mysite.com/admin/client1
Unfortunately, this is not my/open-source code or I would share more :(





On Fri, Sep 6, 2013 at 9:42 PM, Germán  wrote:

> If I understood your question correctly, you want to create an additional
> admin site i.e. have more than one admin site, each one in different URLs.
> This is absolutely possible with stock Django, no need to copy directories
> or anything like that.
>
> What you need is to create another instance of AdminSite, or a custom
> subclass of it, should you need to do so.
>
> https://docs.djangoproject.com/en/1.5/ref/contrib/admin/#django.contrib.admin.AdminSite
>
> On Thursday, September 5, 2013 10:28:38 PM UTC-5, Surgemcgee wrote:
>
>> Ok, never mind. I copied the entire admin dir to the app directory and it
>> is working fairly well here. So naa..
>>
>>
>> On Thu, Sep 5, 2013 at 11:15 PM, Robert Steckroth 
>> wrote:
>>
>>> The application being created requires client to have an admin interface
>>> specific to external
>>> application/use. In other words, I would like to provide unique Admin
>>> model control for a tentative user base. Any thoughts on how one might go
>>> about this? Thanks
>>>
>>> --
>>>  Systems/Software Engineer
>>>
>>>
>>>
>>>
>>
>>
>> --
>>  Systems/Software Engineer
>>
>>
>>
>>   --
> 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 http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
 Systems/Software Engineer

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: SimpleLazyObject for request.user not correctly evaluated inside RequestContext

2013-09-06 Thread Germán
What DB engine are you using? If it is PostgreSQL, you need to roll back 
the transaction after a database error exception (e.g. IntegrityError).

By the way, I think what you are doing is wrong. If the form data is 
invalid, then you need to call . form_invalid

On Friday, September 6, 2013 11:41:34 AM UTC-5, giovanni allegri wrote:
>
> I've opened a new thread, which relates to a previous 
> onefrom me.
> Digging into a wired behaviour in a FormView I've arrived to the following 
> problem:
>
>  - In my "form_valid" method I need to manage exceptions situations.
>  - In case of an exception I want to pass the response flow to an external 
> method, in an other module
>  - This external method returns a "render_to_response", in which I also 
> pass a RequestContext instance built from the "FormView.request" object.
>
> Sometihng like this (I past a simplified version)
>
> class ProjectCreateView(FormView):
>
> def form_valid(self, form):
> try:
> 
> except IntegrityError as e:
> return render_error(_('A project with the same title already 
> exists'),self.request)
>
> def render_error(msg,request):
> #__dummy__ = request.user.is_authenticated()
> data = {'error':{'msg':msg}}
> return 
> render_to_response('generic_error.html',data,context_instance=RequestContext(request))
>
> This causes a DatabaseError, because it crashes when it reaches the 
> user.is_authenticated template variable. The crashed seems to be caused 
> because of the SimpleLazyObject around the User instance. It seems it's not 
> correctly setup, or whatelse... I don't know.
>
> This problem disappears if I use the __dummy__ variable in the previous 
> snippet.
> This call seems to make the SimpleLazyObject "prepared" for later calls 
> (within the context processors).
>
> Why does this happen???
> It never happens in other view and generic views I'm using in my project. 
> What's wrong with the form view?
>
> Notice that 
>
> 1 - the same happens even if I set self.template_name and call 
> self.render_to_response.
> 2 - it doesn't happen during the normal form view workflow
>
> Giovanni
>
>
>
>
>

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to redorder app

2013-09-06 Thread Germán
If you mean reordering *apps*, as in which order the different apps are 
arranged, I think there is no simple way.

Reorder the models for an specific app ? Same answer.

On Friday, September 6, 2013 3:16:59 AM UTC-5, Ranjith Kumar wrote:
>
> Hello,
> I trying to reorder the app in django admin, is there anyways we can do it 
> via admin.py?
>
> Thank you!
>
> -- 
> Cheers,
> Ranjith Kumar K,
> Chennai.
>
> http://ranjithtenz.wordpress.com
>
>
>  

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Error when using python magic in the Django environment

2013-09-06 Thread Germán
Are you sure you are running the *exact same python interpreter*? Are you 
using virtual environments?

On Friday, September 6, 2013 3:39:11 PM UTC-5, Edmond Murphy wrote:
>
> Running:
>
>- Python version 2.7.3
>- Django version 1.5.2
>
> I have a django view that indirectly makes use of python's magic library 
> (basically a ctypes wrapper with access to libmagic) which results in the 
> following error
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib/python2.7/dist-packages/magic.py", line 170, in load
> return _load(self._magic_t, filename)
> ArgumentError: argument 2: : expected CString 
> instance instead of str
>
> In isolation the error is repeatable using the following steps:
>
> ./manage.py shell
> >>> import magic
> >>> m = magic.open(magic.MAGIC_NONE)
> >>> m.load("/usr/share/file/magic.mgc")
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib/python2.7/dist-packages/magic.py", line 170, in load
> return _load(self._magic_t, filename)
> ArgumentError: argument 2: : expected CString 
> instance instead of str
>
>
> Issuing the same commands from a standard python shell does not result in 
> the same error
>
> Python 2.7.3 (default, Jan  2 2013, 13:56:14) 
> [GCC 4.7.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import magic
> >>> m=magic.open(magic.MAGIC_NONE)
> >>> m.load("/usr/share/file/magic.mgc")
> 0
>
> Google searches for the extact typeerror have proved useless, I even 
> attempted to modify magic.py and cast the filename with a 
> ctypes.create_string_buffer() call (AFAIK there is no ctypes.CString type) 
> but that still failed.
>
> The same code works fine running
>
>- Python v. 2.7.3
>- Django v. 1.4.3
>
> I am at a loss so I turn to you "django-users" for help
>
> 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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: What is the best way to have multiple admin users with there own models?

2013-09-06 Thread Germán
If I understood your question correctly, you want to create an additional 
admin site i.e. have more than one admin site, each one in different URLs. 
This is absolutely possible with stock Django, no need to copy directories 
or anything like that.

What you need is to create another instance of AdminSite, or a custom 
subclass of it, should you need to do so.
https://docs.djangoproject.com/en/1.5/ref/contrib/admin/#django.contrib.admin.AdminSite

On Thursday, September 5, 2013 10:28:38 PM UTC-5, Surgemcgee wrote:
>
> Ok, never mind. I copied the entire admin dir to the app directory and it 
> is working fairly well here. So naa..
>
>
> On Thu, Sep 5, 2013 at 11:15 PM, Robert Steckroth 
> 
> > wrote:
>
>> The application being created requires client to have an admin interface 
>> specific to external
>> application/use. In other words, I would like to provide unique Admin 
>> model control for a tentative user base. Any thoughts on how one might go 
>> about this? Thanks
>>
>> -- 
>>  Systems/Software Engineer
>>
>>
>>
>>  
>
>
> -- 
>  Systems/Software Engineer
>
>
>
>  

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Greyed out models in Django Admin

2013-09-06 Thread huw_at1
Ah great I can confirm that moving the admin model settings into a seperate 
admin.py file fixed the issue. I have to say though I'm not sure I 
understand why that issue occurs and also that I'm pretty sure I was 
following a recommended tutorial for setting up models in the admin.

Thanks for the help.

huw_at1

On Thursday, 31 January 2013 22:56:05 UTC, huw_at1 wrote:
>
> Hi,
>
> Using Django 1.4, have registered 3 model classes with admin. When 
> accessing admin page provided by test server can select each class and edit 
> entries. However when accessing production admin the classes are greyed 
> out, only the users, groups and sites are selectable. I thought this might 
> be database access issues however I can run syncdb without any problems. 
> Any ideas?
>
> Many thanks
>
> Huw Jones.
>

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Geodjango and Kriging

2013-09-06 Thread Matthew Scotch
Hi,

I am new to geodjango and was wondering if it has an API for kriging?
So far I have not been able to find anything.
Thanks,
Matthew

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: What is the best way to have multiple admin users with there own models?

2013-09-06 Thread Dan Gentry
I would write views for the client to access their tables rather than using 
the built-in admin.  Your situation is not really what the admin was 
designed to do.  

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django security

2013-09-06 Thread Stefano Probst
Hi!
Do you mean something like the 
documentation
?

Best regards 

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: call to render_to_response with RequestContext within a Generic View causes DatabaseError when resolving the user.is_authenticated template variable

2013-09-06 Thread giovanni allegri
I don't know what is happening but I've solved with a workaround:

dummy = self.request.user.is_authenticated()

calling is_authenticated before returning render_to_response solves the 
problem, because request.user is "casted" to the actual user instance, 
instead of remaining a SimpleLazyObject.

I hope to understand why it happens one day...

giovanni

Il giorno venerdì 6 settembre 2013 16:10:22 UTC+2, giovanni allegri ha 
scritto:
>
> The problem seems to be related with SimpleLazyObject, wrapping the 
> auth.user.
> If during debugging I access the function, everything works fine. It's 
> enough to have the Variables windows open in PyDev.
> If I do not access it, it isn't resolved to the actual user instance (in 
> my case AnonymousUser), and then the template variable lookup fails. I 
> don't know exactly when, but it fails...
>
>
>

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Error when using python magic in the Django environment

2013-09-06 Thread Edmond Murphy
Running:

   - Python version 2.7.3
   - Django version 1.5.2
   
I have a django view that indirectly makes use of python's magic library 
(basically a ctypes wrapper with access to libmagic) which results in the 
following error

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.7/dist-packages/magic.py", line 170, in load
return _load(self._magic_t, filename)
ArgumentError: argument 2: : expected CString 
instance instead of str

In isolation the error is repeatable using the following steps:

./manage.py shell
>>> import magic
>>> m = magic.open(magic.MAGIC_NONE)
>>> m.load("/usr/share/file/magic.mgc")
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.7/dist-packages/magic.py", line 170, in load
return _load(self._magic_t, filename)
ArgumentError: argument 2: : expected CString 
instance instead of str


Issuing the same commands from a standard python shell does not result in 
the same error

Python 2.7.3 (default, Jan  2 2013, 13:56:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import magic
>>> m=magic.open(magic.MAGIC_NONE)
>>> m.load("/usr/share/file/magic.mgc")
0

Google searches for the extact typeerror have proved useless, I even 
attempted to modify magic.py and cast the filename with a 
ctypes.create_string_buffer() call (AFAIK there is no ctypes.CString type) 
but that still failed.

The same code works fine running

   - Python v. 2.7.3
   - Django v. 1.4.3

I am at a loss so I turn to you "django-users" for help

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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


What's the new "field" parameter in the ManyToOneRel __init__ function?

2013-09-06 Thread Mark Young
(I can't really decide if this should go here or in django-dev, since I'm 
asking how to use a private class. If it'd fit better elsewhere, just let 
me know please.)

Hi, I'm working on updating an app (not written by me (django-blog-zannia, 
for the curious)) to python 3.3 and django 1.6 . I've got a test failure 
relating to the fact that the signature for ManyToOneRel has changed, (It 
changed in this commit: 
https://github.com/django/django/commit/97774429aeb54df4c09895c07cd1b09e70201f7d
 , 
in response to this issue: https://code.djangoproject.com/ticket/19385 ) 
gaining a new "field" parameter in the __init__ call. 

I realize that it's a private class, but if anyone could explain what this 
new "field" parameter is supposed to be, it'd be appreciated.

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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django security

2013-09-06 Thread Tom Lockhart

On 2013-09-06, at 4:04 PM, Natko Perko  wrote:

> 
> Obviously not and obviously I couldnt google it.

Ah, of course. What is obviously not obvious to you is not obvious to the rest 
of us either.

Please be specific on what you did find and what you feel you are missing. Even 
if it is obvious. Or not.

hth

  - Tom

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django security

2013-09-06 Thread Natko Perko

Obviously not and obviously I couldnt google it.

Best Regards.

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


SimpleLazyObject for request.user not correctly evaluated inside RequestContext

2013-09-06 Thread giovanni allegri
I've opened a new thread, which relates to a previous 
onefrom me.
Digging into a wired behaviour in a FormView I've arrived to the following 
problem:

 - In my "form_valid" method I need to manage exceptions situations.
 - In case of an exception I want to pass the response flow to an external 
method, in an other module
 - This external method returns a "render_to_response", in which I also 
pass a RequestContext instance built from the "FormView.request" object.

Sometihng like this (I past a simplified version)

class ProjectCreateView(FormView):

def form_valid(self, form):
try:

except IntegrityError as e:
return render_error(_('A project with the same title already 
exists'),self.request)

def render_error(msg,request):
#__dummy__ = request.user.is_authenticated()
data = {'error':{'msg':msg}}
return 
render_to_response('generic_error.html',data,context_instance=RequestContext(request))

This causes a DatabaseError, because it crashes when it reaches the 
user.is_authenticated template variable. The crashed seems to be caused 
because of the SimpleLazyObject around the User instance. It seems it's not 
correctly setup, or whatelse... I don't know.

This problem disappears if I use the __dummy__ variable in the previous 
snippet.
This call seems to make the SimpleLazyObject "prepared" for later calls 
(within the context processors).

Why does this happen???
It never happens in other view and generic views I'm using in my project. 
What's wrong with the form view?

Notice that 

1 - the same happens even if I set self.template_name and call 
self.render_to_response.
2 - it doesn't happen during the normal form view workflow

Giovanni




-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: So this needs to be fixed

2013-09-06 Thread Ramiro Morales
On Fri, Sep 6, 2013 at 1:29 PM, Robert Steckroth
 wrote:
> Also, the manytomany field selector highlight is waaay to light.
>
>
> On Fri, Sep 6, 2013 at 11:22 AM, Robert Steckroth
>  wrote:
>>
>> Why is the user permissions widget not re-sizing? I can hear it now...
>>
>> http://postimg.org/image/mcfbfhs83/

These are both great suggestions Robert.

Please if at all possible open a ticket in our issue tracker
(http://code.djangoproject.com)
reporting them, maybe linking this thread.

Bonus points if you have solutions to these issues and post a patch to
get things moving.

Thanks again.

-- 
Ramiro Morales
@ramiromorales

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: So this needs to be fixed

2013-09-06 Thread Robert Steckroth
Also, the manytomany field selector highlight is waaay to light.


On Fri, Sep 6, 2013 at 11:22 AM, Robert Steckroth  wrote:

> Why is the user permissions widget not re-sizing? I can hear it now...
>
> http://postimg.org/image/mcfbfhs83/
>
>
>
>
> --
>  Systems/Software Engineer
>
>
>
>


-- 
 Systems/Software Engineer

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


So this needs to be fixed

2013-09-06 Thread Robert Steckroth
Why is the user permissions widget not re-sizing? I can hear it now...

http://postimg.org/image/mcfbfhs83/




-- 
 Systems/Software Engineer

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Greyed out models in Django Admin

2013-09-06 Thread huw_at1
Ah ok thanks I will try that and update.

On Thursday, 31 January 2013 22:56:05 UTC, huw_at1 wrote:
>
> Hi,
>
> Using Django 1.4, have registered 3 model classes with admin. When 
> accessing admin page provided by test server can select each class and edit 
> entries. However when accessing production admin the classes are greyed 
> out, only the users, groups and sites are selectable. I thought this might 
> be database access issues however I can run syncdb without any problems. 
> Any ideas?
>
> Many thanks
>
> Huw Jones.
>

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: call to render_to_response with RequestContext within a Generic View causes DatabaseError when resolving the user.is_authenticated template variable

2013-09-06 Thread giovanni allegri
The problem seems to be related with SimpleLazyObject, wrapping the 
auth.user.
If during debugging I access the function, everything works fine. It's 
enough to have the Variables windows open in PyDev.
If I do not access it, it isn't resolved to the actual user instance (in my 
case AnonymousUser), and then the template variable lookup fails. I don't 
know exactly when, but it fails...


-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Login not working.

2013-09-06 Thread Nigel Legg
I have removed the form.is_valid check and renamed the view, this now works
(except for not directing to the correct page, it does appear to be logging
in now)
Thanks!

Cheers, Nigel
07914 740972



On 6 September 2013 14:35, Nigel Legg  wrote:

> I am using django.contrib.auth, and have created the folowing:
>
> view:
> def login(request):
> if request.method == 'POST':
> form = AuthenticationForm(request.POST)
> if form.is_valid():
> username = request.POST['username']
> password = request.POST['password']
> user = authenticate(username=username, password=password)
> if user is not None:
> login(request, user)
> if login == True:
> return render_to_response('myapp/list.html')
> else:
> error = 'Disabled account. Pay your bill!!'
> return render_to_response('auth/login.html',
> {'form': form, 'error': error },
> context_instance=RequestContext(request)
> )
> else:
> error = 'invalid login...'
> return render_to_response('auth/login.html',
> {'form': form, 'error': error },
> context_instance=RequestContext(request)
> )
> else:
> form = AuthenticationForm()
> return render_to_response(
> 'auth/login.html', {'form': form},
> context_instance=RequestContext(request)
> )
>
> template:
> 
>  
> 
>  enctype="multipart/formdata"> {% csrf_token %}
>  {{ error }} 
>  {{ form.username.label_tag }} {{ form.username }} 
>  {{ form.password.label_tag }} {{ form.password }} 
>   
> 
>
> When I go to the login page, and enter the user details, it returns with
> "invalid login", in other words it is failing the is_valid() check.  Am I
> missing something here?  I have checked through the documentation (django
> 1.5) and don't appear to be.
> Any help greatly appreciated.
>
> Cheers, Nigel
> 07914 740972
>
>

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Greyed out models in Django Admin

2013-09-06 Thread Laurent Meunier

Hi,

Your issue seems to be like this one:
http://stackoverflow.com/questions/12780740/no-access-to-models-in-admin-panel-with-debug-false

Try to register your models in admin panel from a new file named 
'admin.py' in the same folder as 'models.py'.



Laurent

On 16/08/2013 07:37, huw_at1 wrote:

Hi,

I still have this issue and can't really figure out what the problem is.
I have found that if I turn on DEBUG then the apps models become active
again such that I can add new records via the admin interface. However
when turning off DEBUG they become inactive and greyed out again.

I have tried altering the order in which my apps are loaded and also
altered the permissions on the applications folder however nothing seems
to solve this.

Sorry for the BUMP but does anyone have any further info on this?

Many thanks

Huw Jones

On Thursday, 31 January 2013 22:56:05 UTC, huw_at1 wrote:

Hi,

Using Django 1.4, have registered 3 model classes with admin. When
accessing admin page provided by test server can select each class
and edit entries. However when accessing production admin the
classes are greyed out, only the users, groups and sites are
selectable. I thought this might be database access issues however I
can run syncdb without any problems. Any ideas?

Many thanks

Huw Jones.

--
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.



--
Laurent Meunier 

--
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problème de création de mon projet (django-admin.py startproject mysite)

2013-09-06 Thread cingusoft
Hi

Chenge your folder
Now you are in the python/scripts folder that have restrictions
To do that you need to add the scripts folder into the variable path and call 
the django-admin from another folder, for example your user document folder.


BlackBerry de movistar, allí donde estés está tu oficin@

-Original Message-
From: edith 
Sender: django-users@googlegroups.com
Date: Fri, 6 Sep 2013 06:51:19 
To: 
Reply-To: django-users@googlegroups.com
Subject: Problème de création de mon projet (django-admin.py startproject 
mysite)

 

Salut, je suis très débutante sur le  framework Django .. 

Je n'arrive pas à créer mon projet, pourtant j'ai survie tous les étapes 
d'installation.

 

Voici le message que je reçois.

 

Merci d’avance pour vos réponses, mon SE est Windows8.
 

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Login not working.

2013-09-06 Thread Nigel Legg
I am using django.contrib.auth, and have created the folowing:

view:
def login(request):
if request.method == 'POST':
form = AuthenticationForm(request.POST)
if form.is_valid():
username = request.POST['username']
password = request.POST['password']
user = authenticate(username=username, password=password)
if user is not None:
login(request, user)
if login == True:
return render_to_response('myapp/list.html')
else:
error = 'Disabled account. Pay your bill!!'
return render_to_response('auth/login.html',
{'form': form, 'error': error },
context_instance=RequestContext(request)
)
else:
error = 'invalid login...'
return render_to_response('auth/login.html',
{'form': form, 'error': error },
context_instance=RequestContext(request)
)
else:
form = AuthenticationForm()
return render_to_response(
'auth/login.html', {'form': form},
context_instance=RequestContext(request)
)

template:

 

 {% csrf_token %}
 {{ error }} 
 {{ form.username.label_tag }} {{ form.username }} 
 {{ form.password.label_tag }} {{ form.password }} 
  


When I go to the login page, and enter the user details, it returns with
"invalid login", in other words it is failing the is_valid() check.  Am I
missing something here?  I have checked through the documentation (django
1.5) and don't appear to be.
Any help greatly appreciated.

Cheers, Nigel
07914 740972

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Greyed out models in Django Admin

2013-09-06 Thread huw_at1
Attached a screenshot to show what I mean (photoshopped a couple of model 
names)

On Friday, 6 September 2013 13:19:34 UTC+1, huw_at1 wrote:
>
> Hmm looks like the django user account has full permissions granted 
> although I am no expert with PostgreSQL.
>
> This is still an issue - any other ideas?
>
> Has anyone else seen this before?
>
> Many thanks
>
> On Sunday, 18 August 2013 22:58:06 UTC+1, huw_at1 wrote:
>>
>> Hi,
>>
>> I'm using the latest Apache server on production.
>>
>> The DEBUG setting is the standard setting that exists within the 
>> settings.py file.
>>
>> I'll check what write permissions the production database user has.
>>
>> Thanks
>>
>> On Thursday, 31 January 2013 22:56:05 UTC, huw_at1 wrote:
>>>
>>> Hi,
>>>
>>> Using Django 1.4, have registered 3 model classes with admin. When 
>>> accessing admin page provided by test server can select each class and edit 
>>> entries. However when accessing production admin the classes are greyed 
>>> out, only the users, groups and sites are selectable. I thought this might 
>>> be database access issues however I can run syncdb without any problems. 
>>> Any ideas?
>>>
>>> Many thanks
>>>
>>> Huw Jones.
>>>
>>

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
<>

Re: Greyed out models in Django Admin

2013-09-06 Thread huw_at1
Hmm looks like the django user account has full permissions granted 
although I am no expert with PostgreSQL.

This is still an issue - any other ideas?

Has anyone else seen this before?

Many thanks

On Sunday, 18 August 2013 22:58:06 UTC+1, huw_at1 wrote:
>
> Hi,
>
> I'm using the latest Apache server on production.
>
> The DEBUG setting is the standard setting that exists within the 
> settings.py file.
>
> I'll check what write permissions the production database user has.
>
> Thanks
>
> On Thursday, 31 January 2013 22:56:05 UTC, huw_at1 wrote:
>>
>> Hi,
>>
>> Using Django 1.4, have registered 3 model classes with admin. When 
>> accessing admin page provided by test server can select each class and edit 
>> entries. However when accessing production admin the classes are greyed 
>> out, only the users, groups and sites are selectable. I thought this might 
>> be database access issues however I can run syncdb without any problems. 
>> Any ideas?
>>
>> Many thanks
>>
>> Huw Jones.
>>
>

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


django security

2013-09-06 Thread Natko Perko
hello,
anyone got some links for in depth django security an built in django 
security thats explained for dummies? :)

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


call to render_to_response with RequestContext within a Generic View causes DatabaseError when resolving the user.is_authenticated template variable

2013-09-06 Thread giovanni allegri
I don't know if I'm following a wrong pattern in the context of Django. 
Inside my class views I need manage exceptions and I would like to pass the 
response workflow to an external method (my exceptions module). In my call 
I pass my ClassView.request variable to be able to use request context 
processors.
I paste an excerpt, where I do the render_to_response call directly from 
the form_valid method, just to test it.

class ProjectCreateView(FormView):
"""Create view."""
(...)

def form_valid(self, form):
"""Form and logic behind project creation."""

project_file = form.cleaned_data['project_file']
thumbnail = form.cleaned_data['thumbnail']
description = form.cleaned_data['description']

try:

except IntegrityError as e:
data = {'error':{'msg':_('project_overwrite_error')}}
return 
render_to_response('generic_error.html',data,context_instance=RequestContext(self.request))
except Exception as e:
return HttpResponse(e)

return HttpResponseRedirect(self.group.get_absolute_url())

(...)


Passing the RequestContext instance causes a DatabaseError, raised when it 
tries to test the user.is_authenticated template context variable.

I've noticed that when used in a basic view method, the resolution of 
user.is_authenticated is called only once, while it's hit twice in the case 
of the generic view. I don't know if it can be the source of the error...

Another strange thing is that it doesn't happen if I debug with a 
breakpoint inside the view dispathc method. Wired!

Here it is the stacktrace: https://gist.github.com/anonymous/6460412

First, I would like to understand why this happens.
Second, how should Itransfer the response flow outside a generic view? It 
works fine until I don't ask for the user variable, so I suppose there 
should be a cleaner way to manage the control tranfer.

Would you help me to solve the issue?
Thanks a lot,
Giovanni

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to redorder app

2013-09-06 Thread Mehmet Gultas
I guess, you're searching for
this
.

Mehmet Gültaş | Research Assistant | Department of Psychology | METU
| +90-312-2105966


On Fri, Sep 6, 2013 at 11:16 AM, Ranjith Kumar wrote:

> Hello,
> I trying to reorder the app in django admin, is there anyways we can do it
> via admin.py?
>
> Thank you!
>
> --
> Cheers,
> Ranjith Kumar K,
> Chennai.
>
> http://ranjithtenz.wordpress.com
>
>
>  --
> 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 http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to redorder app

2013-09-06 Thread Sithembewena Lloyd Dube
If you are referring to reordering fields, yes it is possible. For details,
see the official Django tutorial's section on setting up the admin site at
https://docs.djangoproject.com/en/1.5/intro/tutorial02/

HTH.


On Fri, Sep 6, 2013 at 10:16 AM, Ranjith Kumar wrote:

> Hello,
> I trying to reorder the app in django admin, is there anyways we can do it
> via admin.py?
>
> Thank you!
>
> --
> Cheers,
> Ranjith Kumar K,
> Chennai.
>
> http://ranjithtenz.wordpress.com
>
>
>  --
> 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 http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Regards,
Sithu Lloyd Dube

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


How to redorder app

2013-09-06 Thread Ranjith Kumar
Hello,
I trying to reorder the app in django admin, is there anyways we can do it
via admin.py?

Thank you!

-- 
Cheers,
Ranjith Kumar K,
Chennai.

http://ranjithtenz.wordpress.com

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.