Re: ANN: django-socketio 0.1.0 released

2012-10-09 Thread rahul jain
Can someone please let me know how to fix this?

On Sun, Oct 7, 2012 at 5:35 PM, rahul jain <jainwolver...@gmail.com> wrote:
> Hi Stephen,
>
> I am having issues with the installation. Is this project still
> active? is there any goggle group?
>
> I just downloaded the latest file. Then i tried running the example
> chat application. I can see the messages from the client.
> However, events inside event.py are never getting fired. I think my
> setup is not able to load "events.py". I inserted some print
> statements in both these functions but they never getting printed out
>
> @events.on_message(channel="^room-")
> def message(request, socket, context, message):
>
> @events.on_finish(channel="^room-")
> def finish(request, socket, context):
>
> Please can you let me know how to fix this?
>
> My django version:
>
> (1, 3, 1, 'final', 0)
>
> Messages from the client after running on python manage.py runserver_socketio
>
> 127.0.0.1 - - [2012-10-07 17:02:13] "Socket.IO message: {u'action':
> u'start', u'room': 2, u'name': u'test'}"
> 127.0.0.1 - - [2012-10-07 17:02:54] "Socket.IO message: {u'action':
> u'start', u'room': 2, u'name': u'test'}"
> 127.0.0.1 - - [2012-10-07 17:03:05] "Socket.IO subscribe: room-2"
> 127.0.0.1 - - [2012-10-07 17:03:16] "Socket.IO subscribe: room-2"
> 127.0.0.1 - - [2012-10-07 17:04:23] "Socket.IO subscribe: room-2"
> 127.0.0.1 - - [2012-10-07 17:06:45] "Socket.IO subscribe: room-2"
> 127.0.0.1 - - [2012-10-07 17:06:50] "Socket.IO message: {u'action':
> u'start', u'room': 2, u'name': u'test'}"
> 127.0.0.1 - - [2012-10-07 17:07:52] "Socket.IO subscribe: room-2"
>
> Appreciate your time!
>
> Thanks.
>
> RJ
>
>
>
>
>
> On Fri, Aug 12, 2011 at 9:06 PM, Stephen McDonald <stephen...@gmail.com> 
> wrote:
>> Hi all,
>>
>> Our Django Dash entry http://drawnby.jupo.org made extensive use of
>> Socket.IO (cross-browser websockets) and born out of that I've created a new
>> django-socketio package which is now available:
>>
>> Github: https://github.com/stephenmcd/django-socketio
>> Bitbucket: https://bitbucket.org/stephenmcd/django-socketio
>> PyPI: http://pypi.python.org/pypi/django-socketio/
>>
>> Here's an overview from the docs:
>>
>> django-socketio is a BSD licensed Django application that brings together a
>> variety of features that allow you to use WebSockets seamlessly with any
>> Django project. django-socketio was inspired by Cody Soyland's introductory
>> blog post on using Socket.IO and gevent with Django, and made possible by
>> the work of Jeffrey Gelens' gevent-websocket and gevent-socketio packages.
>> The features provided by django-socketio are:
>>
>> - Installation of required packages from PyPI
>> - A management command for running gevent's pywsgi server with
>> auto-reloading capabilities
>> - A channel subscription and broadcast system that extends Socket.IO
>> allowing WebSockets and events to be partitioned into separate concerns
>> - A signals-like event system that abstracts away the various stages of a
>> Socket.IO request
>> - The required views, urlpatterns, templatetags and tests for all the above
>>
>> Cheers,
>> Steve
>>
>> --
>> Stephen McDonald
>> http://jupo.org
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ANN: django-socketio 0.1.0 released

2012-10-07 Thread rahul jain
Hi Stephen,

I am having issues with the installation. Is this project still
active? is there any goggle group?

I just downloaded the latest file. Then i tried running the example
chat application. I can see the messages from the client.
However, events inside event.py are never getting fired. I think my
setup is not able to load "events.py". I inserted some print
statements in both these functions but they never getting printed out

@events.on_message(channel="^room-")
def message(request, socket, context, message):

@events.on_finish(channel="^room-")
def finish(request, socket, context):

Please can you let me know how to fix this?

My django version:

(1, 3, 1, 'final', 0)

Messages from the client after running on python manage.py runserver_socketio

127.0.0.1 - - [2012-10-07 17:02:13] "Socket.IO message: {u'action':
u'start', u'room': 2, u'name': u'test'}"
127.0.0.1 - - [2012-10-07 17:02:54] "Socket.IO message: {u'action':
u'start', u'room': 2, u'name': u'test'}"
127.0.0.1 - - [2012-10-07 17:03:05] "Socket.IO subscribe: room-2"
127.0.0.1 - - [2012-10-07 17:03:16] "Socket.IO subscribe: room-2"
127.0.0.1 - - [2012-10-07 17:04:23] "Socket.IO subscribe: room-2"
127.0.0.1 - - [2012-10-07 17:06:45] "Socket.IO subscribe: room-2"
127.0.0.1 - - [2012-10-07 17:06:50] "Socket.IO message: {u'action':
u'start', u'room': 2, u'name': u'test'}"
127.0.0.1 - - [2012-10-07 17:07:52] "Socket.IO subscribe: room-2"

Appreciate your time!

Thanks.

RJ





On Fri, Aug 12, 2011 at 9:06 PM, Stephen McDonald  wrote:
> Hi all,
>
> Our Django Dash entry http://drawnby.jupo.org made extensive use of
> Socket.IO (cross-browser websockets) and born out of that I've created a new
> django-socketio package which is now available:
>
> Github: https://github.com/stephenmcd/django-socketio
> Bitbucket: https://bitbucket.org/stephenmcd/django-socketio
> PyPI: http://pypi.python.org/pypi/django-socketio/
>
> Here's an overview from the docs:
>
> django-socketio is a BSD licensed Django application that brings together a
> variety of features that allow you to use WebSockets seamlessly with any
> Django project. django-socketio was inspired by Cody Soyland's introductory
> blog post on using Socket.IO and gevent with Django, and made possible by
> the work of Jeffrey Gelens' gevent-websocket and gevent-socketio packages.
> The features provided by django-socketio are:
>
> - Installation of required packages from PyPI
> - A management command for running gevent's pywsgi server with
> auto-reloading capabilities
> - A channel subscription and broadcast system that extends Socket.IO
> allowing WebSockets and events to be partitioned into separate concerns
> - A signals-like event system that abstracts away the various stages of a
> Socket.IO request
> - The required views, urlpatterns, templatetags and tests for all the above
>
> Cheers,
> Steve
>
> --
> Stephen McDonald
> http://jupo.org
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



celery workers not consuming messages

2012-07-17 Thread rahul jain
All,

I have started celery on development server using this:

python manage.py celeryd -E --loglevel=info

I can see from rabbitmq management UI that its receiving messages under
ready Queue.
Screenshot attached.

Rabbitmq logs though sometimes print it and sometimes not


=INFO REPORT 17-Jul-2012::19:42:07 ===
accepting AMQP connection <0.8577.0> (127.0.0.1:51123 -> 127.0.0.1:5672)

But the major problem is celery workers not consuming these messages and
not processing them.

I am using django 1.3

rabbit,"RabbitMQ","2.8.4"

amqp_client,"RabbitMQ AMQP Client","2.8.4


My django settings file:


INSTALLED_APPS = (

blah,
'djcelery',
'celerytest',
)

import djcelery
djcelery.setup_loader()

Running python manage.py runserver

Any pointers will be appreciated. How to debug this?

Thanks.

RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

<>

Re: MySQL limit sub-query problem

2012-01-26 Thread rahul jain
Works! Great! thanks!!! Lazy querysets!

On Thu, Jan 26, 2012 at 12:32 PM, Alasdair Nicol <alasd...@memset.com> wrote:
> Hi RJ,
>
>
> On 26/01/12 20:10, rahul jain wrote:
>>
>> All,
>>
>> I have a query. Its working fine on sqlite server but not working fine
>> on mysql server.
>>
>> This is the error message on mysql server:  "This version of MySQL
>> doesn't yet support 'LIMIT&  IN/ALL/ANY/SOME subquery"
>>
>>
>> This is the query:
>>
>> inner_q = obj_unassigned.values_list('pk', flat=True)[:diff]
>> total_objects = (obj_assigned | obj_class.objects.filter(pk__in=inner_q))
>>
>> Any help appreciated on how to fix this.
>>
>> Thanks.
>>
>> RJ
>>
>
> You can prevent the error by using `list()` to fetch the inner queryset in a
> separate query:
>
> total_objects = (obj_assigned |
> obj_class.objects.filter(pk__in=list(inner_q)))
>
> Alasdair
>
> --
> Alasdair Nicol
> Developer, MEMSET
>
> mail: alasd...@memset.com
>  web: http://www.memset.com/
>
> Memset Ltd., registration number 4504980. 25 Frederick Sanger Road,
> Guildford, Surrey, GU2 7YD, UK.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



MySQL limit sub-query problem

2012-01-26 Thread rahul jain
All,

I have a query. Its working fine on sqlite server but not working fine
on mysql server.

This is the error message on mysql server:  "This version of MySQL
doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery"

This is the query:

inner_q = obj_unassigned.values_list('pk', flat=True)[:diff]
total_objects = (obj_assigned | obj_class.objects.filter(pk__in=inner_q))

Any help appreciated on how to fix this.

Thanks.

RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: runserver namespace problem?

2011-12-27 Thread rahul jain
Having the same problem "Received unregistered task of type blah" . Can
someone help ?




On Sun, Nov 13, 2011 at 5:26 PM, Ken  wrote:

> Does anybody have any idea?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: drag and drop rows on django admin

2011-07-30 Thread rahul jain
Makes sense guys. Sorry email I typed from my phone and in the first one the
subject was not appropriate.
So i send the another one with subject that sounds right and more likely
people who know will be reading it!

I also get mad when I see emails with bad subject or less info to solve the
problem. But I did the same :(

Sorry next time, I will be more crystal and clear in my emails. Otherwise, I
will not send.

Thanks for the link though (
https://code.djangoproject.com/wiki/UsingTheMailingList#Donts:).
I was able to derive lot of good info out of it.

Thanks for your help and time.

Rahul



On Tue, Jul 26, 2011 at 11:30 PM, Derek <gamesb...@gmail.com> wrote:

> On Jul 26, 11:03 am, Tom Evans <tevans...@googlemail.com> wrote:
> > On Tue, Jul 26, 2011 at 6:32 AM, rahul jain <jainwolver...@gmail.com>
> wrote:
> > > Tried this snippet but not working
> >
> > >http://djangosnippets.org/snippets/2306/
> >
> > > Anyone else tried it, I would like to drag and drop rows on django
> admin.
> >
> > > Thanks.
> >
> > > RJ
> >
> > 1) Resending the same message with a different subject within such a
> > short space of time is considered rude. People are busy, and will help
> > you as and when they can, be patient. If you can't be patient, people
> > probably won't help you.
> >
> > 2) "Tried  but it doesn't work" is useless. What did you try? Where
> > did you put the snippet? What happened? What did you expect to happen?
> > What were the exact error messages (if any)?
> >
> > 3) The comments for that snippet clearly says that it is for grapelli.
> > Grapelli is not django admin, it is a replacement for django admin.
> > It's not clear from your post whether you are even using grapelli.
>
> Tom is being very polite here... he could just have pointed you to:
> https://code.djangoproject.com/wiki/UsingTheMailingList#Donts:
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



drag and drop rows on django admin

2011-07-25 Thread rahul jain
Tried this snippet but not working

http://djangosnippets.org/snippets/2306/

Anyone else tried it, I would like to drag and drop rows on django admin.

Thanks.

RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



snippet

2011-07-25 Thread rahul jain
Tried this snippet but not working

http://djangosnippets.org/snippets/2306/

Anyone else tried it, I would like to drag and drop rows on django admin.

Thanks.

RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



python threads and django views

2011-05-30 Thread rahul jain
All,

I would like to know how to do this?

For example, in my views I have to visit 10,000 websites (make url
connection).   Each of those connections are independent connections.
I would like to hit them as quickly as possible. Then return an
http-response with some results.

I have few questions now

Obviously, I cannot hit these sites sequentially, that will take forever.
Also, I believe its not possible, Django, put response time-out for each of
those view responses!

Creating 10,000 threads also is not a good idea.Therefore, I created queue
based threads.
I created 100 working threads and infinite size queue (i am not sure if this
is a good idea)
But receiving max URL connection error!

How to fix this "max URL connection error" ? In addition, any tips for
correctly implementing threads in django will be very helpful.
Also, how to set the max timeout for http-responses  (django views) ?

Thanks.

Rahul

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Hidden rows elements also visible on list filters

2011-05-26 Thread rahul jain
Yes I am referring to django admin list filter, one on the side.


class Admin(model.Admin):

list_filter = (column1, column2)


so for instance column1 has 6 values (a, b,b,b,c,e). Then list filter shows
a,b, c,e.

like this

By column1

show all
a
b
c
e

Now if i hide some rows based on the logged in user and reduce the number of
queries to  4 values (a,c).
But instead what i see is this same as with no hidden rows ie.

By column1

show all
a
b
c
e

The expected result which I would like to see is this

By column1

show all
a
c

Please let me know how to solve this problem.

Thanks.

RJ








On Wed, May 4, 2011 at 10:06 PM, Andy McKay  wrote:

> > problem is that few rows i have disabled.
> > But list filter still displays those rows as well.
>
> Are you using the built in django admin, or something else?
> By "disabled" what do you mean, a change in the model or something else?
>
> Until you give us a bit more information, we are unlikely to be able to
> help. But here's a bet:
>
>
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter
>
> The example for DecadeBornListFilter shows how you can define a custom
> queryset and perhaps this will allow you to filter out disabled rows.
> --
>  Andy McKay
>  a...@clearwind.ca
>  twitter: @andymckay
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Hidden rows elements also visible on list filters

2011-05-04 Thread rahul jain
All,

How to fix this ? Hidden rows elements also visible on list filters.

ex:

I have a list filter on one of the columns ,

list filter for that column displays all the distinct values, but the
problem is that few rows i have disabled.
But list filter still displays those rows as well.

How to fix this ?

Thanks.

RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



hidden rows common elements also visible on list filters

2011-05-04 Thread rahul jain
All,

Hidden rows elements also visible on list filters ?

ex:

I have a list filter on one of the columns ,

list filter for that column displays all the distinct values, but the
problem is that few rows i have disabled.
But list filter still displays those rows as well.

How to fix this ?

Thanks.

RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



change the displayed name of the app in the Django admin?

2011-04-20 Thread rahul jain
Can you change the displayed name of the app in the Django admin?

for ex: Select "app_name" to change

Thanks.

Rahul

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: css issues

2011-04-09 Thread rahul jain
Sorry for the incomplete message.

This what the structure looks like now

mysite/

  media /
   css /
  file1
   js/
   js1
   img/
   img1


Settings.py

MEDIA_ROOT = ''
MEDIA_URL = ''
ADMIN_MEDIA_PREFIX = '/media/'

This is tested using development server and I have checked after deleting
cache.  But if if modify my css file, it still takes from my django
installation not from my local css file !

Please let me know what i am missing !

Thanks.

Rahul








On Sat, Apr 9, 2011 at 7:34 PM, rahul jain <jainwolver...@gmail.com> wrote:

> All,
>
> I copied the media directory from django project into my site project.
> This is what it looks like now
>
> mysite/
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



css issues

2011-04-09 Thread rahul jain
All,

I copied the media directory from django project into my site project.  This
is what it looks like now

mysite/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



how to have different logo for django admin based on URL

2011-04-08 Thread rahul jain
Anyone ever tried to have different logos for admin based on the URL

Like

http://url/comp1

use comp1 logo for django admin always


http://url/comp2

use comp2 logo for django admin always

Thanks.

Rahul

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



modify existing widget

2011-03-20 Thread rahul jain
All,

How to edit existing foreign key/manytomany field widget. I would like to
remove that + sign (link to add more enteries).
[image: manytomany.png]

Please let me know.

Thanks.

Rahul

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

<><>

standalone server

2011-02-08 Thread rahul jain
Hi Guys,

I would like to create a standalone server using django environment which
accepts/receive inputs through socket connections. After that some
processing and then updating the database.

I created one python server and set the environment variable  but I figured
out that as soon as something goes wrong, server crashes and then I have to
manually re-run the server. So was not reliable at all.

Please if someone worked on these kind of issues before where you would like
to accept connections from outside not web request, but would like to
receive some data from outside through sockets then please let me know how
to best deal with it.

thanks.

Rahul

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



how to remove add and change links on admin dashboard

2011-01-22 Thread rahul jain
Hi Guys,

how to remove add and change links + icons on admin dashboard ?

Thanks.

Rahul

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



how to map admin actions with shortcut keys

2011-01-09 Thread rahul jain
How to map admin actions with shortcut keys ?

I have an action to perform on rows (objects) which changes the value of one
of the columns(fields) to "x" and some to "y" and some to "z".
I would like to save some time by not going through the normal route (after
selecting the rows, selecting from the drop down menu, the action to be
performed, then clicking go).

Is it possible to make it faster ?

One of ways i could think is through shortcut keys

Key 1 -> Perform admin action "x" on some rows

Key 2 -> Perform admin action "y" on some rows

key 3 -> Perform admin action "z" on some rows

Will appreciate if you can let me know how to approach this problem ?

Thanks.

Rahul

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Using new messages framework within built-in admin ?

2011-01-03 Thread rahul jain
anyone on this ?

How to display error messages ?

On Thu, May 27, 2010 at 3:49 AM, Nicolas Steinmetz wrote:

> Nobody on this issue ?
>
> On 21 mai, 15:46, Nicolas Steinmetz  wrote:
> > Hi,
> >
> > For some actions I made from the Django built-in admin, I would like
> > to improve the user experience with a better distinction between
> > sucess & error messages.
> >
> > With Django 1.1.x, I used to use Model admin actions [1] with
> > statements like :
> >
> > modeladmin.message_user(request, "%s successfully marked as
> > published." % message_bit)
> >
> > With the new 1.2 version, I was about to use the messages framework
> > and the messages.success() / messages.error() shortcuts to provide a
> > better experience. I now have in my code :
> >
> > messages.success(request, "%s successfully marked as published." %
> > message_bit)
> >
> > So running my own admin/base.html file, I replaced the messages
> > section by the example provided in the doc [2] :
> >
> > {% if messages %}
> > 
> > {% for message in messages %}
> > {{
> message }}
> >
> > {% endfor %}
> > 
> > {% endif %}
> >
> > What happens is that messages.tags is empty.If I understand well the
> > doc, I should have an "error" or "success" tags for my error/success
> > messages.
> >
> > What did I miss ? Or is it a bug ? Or the admin do not use yet the new
> > message framework ?
> >
> > [1]
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/#actio...
> > [2]
> http://docs.djangoproject.com/en/1.2/ref/contrib/messages/#ref-contri...
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> > For more options, visit this group athttp://
> groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



how to raise an error on django admin

2011-01-03 Thread rahul jain
Hi,

How to display an error in django admin (the error should be displayed in
red just like in forms)

Something of this form

http://groups.google.com/group/django-users/browse_thread/thread/68d4ea1915654134/447ef8473cf86672

Thanks.

Rahul

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



how to view the uploaded files

2010-12-29 Thread rahul jain
How to view the uploaded files on admin ?

Thanks.

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Foreign key Real world use case Q

2010-12-26 Thread rahul jain
Foriegn Key Use case

Class Item():
  desc = models.StringFrield()

Class Menu():
   type = models.StringField(default = "Italian")   ///cuisine type
   item_list = models.ForiegnKey(Item)

So for each cuisine I have some list of items

for ex:

menu type 1 for ex  have 5  items (item 1, item2, item 3, item4, item5)

Creating items is easy

item = Item()
item.desc = "item1"
item.save()

item = Item()
item.desc = "item 2"
item.save()

so on..

Now I have to create just a single menu item

menu = Menu()
menu.type ="Italian"
menu.item_list = ???   ///i am not sure what should be this , should
it be assigned to any one of them

Then how to retreieve the list of items for a menu ex: here Italian

Thanks.

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Tracking model object changes

2010-11-27 Thread rahul jain
Found very similar projecst but not sure which one to use it. Would like to
track the modified object , modified time and the user who modified it.


   - Django Audit for MongoDB 
   - AuditTrail 
   - AuditLog 
   - Django-audit 

Please let me know which one will be ideal for my case.

Thanks.

Rahul

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



list_editable asynchronous

2010-11-27 Thread rahul jain
How to make list _editable asynchronus ?

I would not like to save by pressing save button. Instead, as soon as I
modify the wizard it should save by itself.

Thanks.

Rahul

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: change ordering of objects/rows on change list view on admin

2010-09-19 Thread rahul jain
 I mean graphically/directly on the UI itself.

On Sun, Sep 19, 2010 at 2:29 PM, Sævar Öfjörð <saeva...@gmail.com> wrote:

>
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.ordering
>
> On Sep 19, 10:56 pm, rahul jain <jainwolver...@gmail.com> wrote:
> > Hi there !,
> >
> > How to change ordering of objects/rows on change list view on admin ?
> >
> > --Rahul
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



change ordering of objects/rows on change list view on admin

2010-09-19 Thread rahul jain
Hi there !,

How to change ordering of objects/rows on change list view on admin ?

--Rahul

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: python threading admin actions weird problem

2010-08-14 Thread rahul jain
Sorry one more thing

Sometimes it starts with

check = False

Its happening at random time.


--RJ

On Sat, Aug 14, 2010 at 7:36 PM, rahul jain <jainwolver...@gmail.com> wrote:
> Hi there !
>
> Some weird problem happening with admin actions.
>
> My admin action create threads which access a shared variable.
> Those threads change the state of the variable for ex
>
> check = False (a boolean)
>
> One of the thread sets it to True
>
> At this time I am done with that entire request.
>
> Now if I run the admin action again the state of the variable "check" is
>
> check = True
>
> which is not right. It should be
>
> check = False since its a completely new request.
>
> Its happening on both on development (django local server ) and
> production (Apache server).
>
> What could be the problem ?
>
> -RJ
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



python threading admin actions weird problem

2010-08-14 Thread rahul jain
Hi there !

Some weird problem happening with admin actions.

My admin action create threads which access a shared variable.
Those threads change the state of the variable for ex

check = False (a boolean)

One of the thread sets it to True

At this time I am done with that entire request.

Now if I run the admin action again the state of the variable "check" is

check = True

which is not right. It should be

check = False since its a completely new request.

Its happening on both on development (django local server ) and
production (Apache server).

What could be the problem ?

-RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: list display based on logged-in user

2010-07-15 Thread rahul jain
nope there is a problem after overriding it, i cannot see the check
boxes now. One which is used for performing admin actions, even though
i can see all the admin actions. If I uncomment the CustomAdmin then i
am able to  see the select boxes on the individual rows as well as
"select all". What could be missing now ?

-Rahul

On Fri, Jul 9, 2010 at 2:50 PM, rahul jain <jainwolver...@gmail.com> wrote:
> yup that's 100% correct :)
>
> Rahul
>
> On Fri, Jul 9, 2010 at 10:27 AM, raj <rajeeshrn...@gmail.com> wrote:
>> You are trying to override change_view instead of changelist_view.
>> Otherwise your approach must work.
>> class CustomAdmin(admin.ModelAdmin):
>>    def changelist_view(whatever_args_are_here):
>>        if condition:
>>                self.list_display = custom_list
>>       return super(CustomAdmin, self).changelist_view(...)
>>
>> On Jul 9, 6:16 am, rahul jain <jainwolver...@gmail.com> wrote:
>>> anyone on this ?
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: None field : Admin save setting it to empty value instead of NULL during save

2010-07-15 Thread rahul jain
anyone on this ?

On Tue, Jul 13, 2010 at 2:44 PM, rahul jain <jainwolver...@gmail.com> wrote:
> Could it be generic ?. I mean i don't want to specify self.naughty_field.
>
> How to do it for self.any_field ?
>
> RJ
>
> On Tue, Jun 29, 2010 at 9:29 AM, euan.godd...@googlemail.com
> <euan.godd...@gmail.com> wrote:
>> Django admin can't differentiate between empty string and None and
>> picks empty string which makes sense in most cases.
>>
>> If you don't like the idea of empty string override the save method
>> and coerce empty string to None before calling the super classes save,
>> e.g.
>>
>> class YourModel(models.Model):
>>    ...
>>
>>   def save(self, *args, **kwargs):
>>        if self.naughty_field == '':
>>            self.naughty_field = None
>>        super(YourModel, self).save(*args, **kwargs)
>>
>> Euan
>>
>> On Jun 29, 4:15 pm, rahul jain <jainwolver...@gmail.com> wrote:
>>> Hi there !
>>>
>>> One of my model fields attribute is set to null="true" to allow None
>>> values. But if I use admin to save those model objects and leave it
>>> blank, it saves blank value instead of None.
>>> How to fix this ?
>>>
>>> And Blank value is not None. Blank is "" (empty) but None is NULL in 
>>> databases.
>>>
>>> -RJ
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: None field : Admin save setting it to empty value instead of NULL during save

2010-07-13 Thread rahul jain
Could it be generic ?. I mean i don't want to specify self.naughty_field.

How to do it for self.any_field ?

RJ

On Tue, Jun 29, 2010 at 9:29 AM, euan.godd...@googlemail.com
<euan.godd...@gmail.com> wrote:
> Django admin can't differentiate between empty string and None and
> picks empty string which makes sense in most cases.
>
> If you don't like the idea of empty string override the save method
> and coerce empty string to None before calling the super classes save,
> e.g.
>
> class YourModel(models.Model):
>    ...
>
>   def save(self, *args, **kwargs):
>        if self.naughty_field == '':
>            self.naughty_field = None
>        super(YourModel, self).save(*args, **kwargs)
>
> Euan
>
> On Jun 29, 4:15 pm, rahul jain <jainwolver...@gmail.com> wrote:
>> Hi there !
>>
>> One of my model fields attribute is set to null="true" to allow None
>> values. But if I use admin to save those model objects and leave it
>> blank, it saves blank value instead of None.
>> How to fix this ?
>>
>> And Blank value is not None. Blank is "" (empty) but None is NULL in 
>> databases.
>>
>> -RJ
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: list display based on logged-in user

2010-07-09 Thread rahul jain
yup that's 100% correct :)

Rahul

On Fri, Jul 9, 2010 at 10:27 AM, raj <rajeeshrn...@gmail.com> wrote:
> You are trying to override change_view instead of changelist_view.
> Otherwise your approach must work.
> class CustomAdmin(admin.ModelAdmin):
>    def changelist_view(whatever_args_are_here):
>        if condition:
>                self.list_display = custom_list
>       return super(CustomAdmin, self).changelist_view(...)
>
> On Jul 9, 6:16 am, rahul jain <jainwolver...@gmail.com> wrote:
>> anyone on this ?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: list display based on logged-in user

2010-07-08 Thread rahul jain
anyone on this ?

On Thu, Jul 8, 2010 at 11:56 AM, rahul jain <jainwolver...@gmail.com> wrote:
> I am not sure what I am doing wrong but this should work
>
> class TestAdmin(admin.ModelAdmin):
>
>        list_display = (field1, field2, field3, fileld4, field5,field6)
>
>
> class CustomTestAdmin(TestAdmin):
>
>        custom_list_display = (field1, field2, field3)     # showing less
> number of fields
>
>        def change_view(self, request, *args, **kwargs):
>                if not request.user.is_superuser:
>                        self.list_display = self.custom_list_display    # 
> setting list display
>                        return TestAdmin.change_view(self, request, *args, 
> **kwargs)
>                else:
>                        return TestAdmin.change_view(self, request, *args, 
> **kwargs)
>
> admin.site.register (Test, CustomTestAdmin)
>
> So even if the user is not super user display is same, all the fields :( .
>
> --RJ
>
>
>
>
>
>
>
>
>
> On Thu, Jul 8, 2010 at 6:56 AM, derek <gamesb...@gmail.com> wrote:
>> On Jul 7, 11:40 pm, rahul jain <jainwolver...@gmail.com> wrote:
>>> Hi there !
>>>
>>> I would like to display model fields based on the logged-in user.
>>>
>>> If user is restricted user
>>>
>>> list_display = (field1, field2)
>>>
>>> else
>>>
>>> list_display = (field1, field2, field3, field4)
>>>
>>> How is it possible ?
>>>
>>
>> Also see:
>> http://stackoverflow.com/questions/2297377/how-do-i-prevent-permission-escalation-in-django-admin-when-granting-user-change
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: list display based on logged-in user

2010-07-08 Thread rahul jain
I am not sure what I am doing wrong but this should work

class TestAdmin(admin.ModelAdmin):

list_display = (field1, field2, field3, fileld4, field5,field6)


class CustomTestAdmin(TestAdmin):

custom_list_display = (field1, field2, field3) # showing less
number of fields

def change_view(self, request, *args, **kwargs):
if not request.user.is_superuser:
self.list_display = self.custom_list_display# 
setting list display
return TestAdmin.change_view(self, request, *args, 
**kwargs)
else:
return TestAdmin.change_view(self, request, *args, 
**kwargs)

admin.site.register (Test, CustomTestAdmin)

So even if the user is not super user display is same, all the fields :( .

--RJ









On Thu, Jul 8, 2010 at 6:56 AM, derek <gamesb...@gmail.com> wrote:
> On Jul 7, 11:40 pm, rahul jain <jainwolver...@gmail.com> wrote:
>> Hi there !
>>
>> I would like to display model fields based on the logged-in user.
>>
>> If user is restricted user
>>
>> list_display = (field1, field2)
>>
>> else
>>
>> list_display = (field1, field2, field3, field4)
>>
>> How is it possible ?
>>
>
> Also see:
> http://stackoverflow.com/questions/2297377/how-do-i-prevent-permission-escalation-in-django-admin-when-granting-user-change
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



list display based on logged-in user

2010-07-07 Thread rahul jain
Hi there !

I would like to display model fields based on the logged-in user.

If user is restricted user

list_display = (field1, field2)

else

list_display = (field1, field2, field3, field4)

How is it possible ?

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



None field : Admin save setting it to empty value instead of NULL during save

2010-06-29 Thread rahul jain
Hi there !

One of my model fields attribute is set to null="true" to allow None
values. But if I use admin to save those model objects and leave it
blank, it saves blank value instead of None.
How to fix this ?

And Blank value is not None. Blank is "" (empty) but None is NULL in databases.

-RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Just one action on all the objects

2010-06-27 Thread rahul jain
Hi Tom,

One possible solution could be you can increase the number of objects
shown on change list page and set it to your max objects. Only problem
is your page becomes super long. Which is not a good solution.
Secondly, before doing any action on admin objects, you can select
"show all".  Thirdly, in your admin function, you can override
queryset. So even if the user selects one object, or the number of
objects on the same page, you can set  the queryset to
(.objects.all()) in your admin function. These are all
workarounds but not a good solution.

I think there has to be something from Django which let you apply an
action on all the objects. I mean both functionalities should exist.
One to let you apply admin action on individual objects and the
another is to let you apply admin action on all the objects, hiding
the check-boxes.

--RJ






On Sun, Jun 27, 2010 at 4:43 AM, tom <tomercohen1...@gmail.com> wrote:
> In the same manner - 'check all' only check the currently visible
> results (100 by default) in the change list page.
> I want that check all will actually check all the results, even the
> tuples in the next pages...
>
> anyone?
>
> thanks!
> tom
>
> On May 26, 9:46 am, rahul jain <jainwolver...@gmail.com> wrote:
>> Hi Django,
>>
>> Can i run an action without any need toselectall. It should by
>> defaultselecteverything, basicallyalltheobjects. No separate
>> checkbox for every object, noselectall.
>> Also, possibly no choices, just a single button which say "action"
>> which should perform that action onalltheobjects.
>>
>> for ex:
>>
>> HTML Button say "Delete" on the top ofchangelistpage. When I hit it
>> performs delete operation onalltheobjects.
>>
>> I need it because I want to perform just one action onalltheobjects.
>>
>> --RJ
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: list_editable and save changes to individual row/cell

2010-06-27 Thread rahul jain
Good question. Anyone on this ?

On Fri, Jun 25, 2010 at 9:48 AM, Jason Wang  wrote:
> Hi all,
>
> Does anyone know if there is a way to save changes on a per row/cell
> basis for forms with list_editable in django admin? I would like to
> have a button for each row and each cell to do that.
>
> Thanks a lot!
>
> Jason
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: admin filters getting reset after admin action

2010-06-19 Thread rahul jain
well I solved that problem with one line of statement.

before self.message_user

just use this

return HttpResponseRedirect(request.get_full_path())

Hope it helps.

--RJ



On Sat, Jun 19, 2010 at 11:09 AM, derek <gamesb...@gmail.com> wrote:
> On Jun 18, 9:18 pm, swinton <stevewin...@gmail.com> wrote:
>> On Jun 17, 4:13 pm, derek <gamesb...@gmail.com> wrote:
>>
>> > On Jun 17, 5:44 am, rahul jain <jainwolver...@gmail.com> wrote:
>>
>> > > Hi there,
>>
>> > > I have some filters set-up on admin page. As soon as I perform admin
>> > > action. All filters are getting reset.
>>
>> > > Is this is a bug from framework ?
>>
>> > No.  There are work-arounds to get back to these; Google this group
>> > for suggestions.
>>
>> Hi there,
>>
>> I'm trying to do the same (retain admin filters after action). I've
>> searched this group for suggestions, but have failed to come up with
>> anything. Can anyone give me some pointers?
>
> Not sure how you searched or why you missed this:
> http://groups.google.com/group/django-users/browse_thread/thread/d403af7a8dcdc90e/d69717b0e9a1f075
>
> Derek
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



admin filters getting reset after admin action

2010-06-16 Thread rahul jain
Hi there,

I have some filters set-up on admin page. As soon as I perform admin
action. All filters are getting reset.

Is this is a bug from framework ?

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



admin actions

2010-06-16 Thread rahul jain
Hi,

I would like to display javascript alert boxes when something goes
wrong during admin actions. Is it possible ?

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: not able to recognize non-default python files in app + project directory

2010-06-11 Thread rahul jain
It was rw-r--r-- . I also modified it to 777 by" chmod -R 777". But
did not fix my problem.

This is the error which I am getting
ImportError: cannot import name 

--RJ


On Fri, Jun 11, 2010 at 7:59 AM, Tom Evans <tevans...@googlemail.com> wrote:
> On Fri, Jun 11, 2010 at 3:47 PM, rahul jain <jainwolver...@gmail.com> wrote:
>> Hi Tim,
>>
>> Here is my structure
>>
>> app
>> |-- __init__.py
>> |-- models.py (all  my models)
>> |-- auth.py  (python functions referencing models defined in models.py)
>> |-- blogs.py (python functions referencing models defined in models.py)
>> |-- views.py (python functions referencing models defined in models.py)
>>
>>
>> for auth.py and blogs.py referencing is giving import error.
>>
>> Again in these files. If I do import like
>>
>> from app.models import User then I get import error.
>>
>> For views.py I am able to easily import @above.
>>
>> --RJ
>>
>
> That all looks correct. Are the file permissions correct?
>
> Can you show 'ls -l /path/to/app/' please.
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: not able to recognize non-default python files in app + project directory

2010-06-11 Thread rahul jain
Hi Tim,

Here is my structure

app
|-- __init__.py
|-- models.py (all  my models)
|-- auth.py  (python functions referencing models defined in models.py)
|-- blogs.py (python functions referencing models defined in models.py)
|-- views.py (python functions referencing models defined in models.py)


for auth.py and blogs.py referencing is giving import error.

Again in these files. If I do import like

from app.models import User then I get import error.

For views.py I am able to easily import @above.

--RJ






On Fri, Jun 11, 2010 at 7:18 AM, Tom Evans  wrote:
> I'll give you the benefit of the doubt since it seems some of this is
> getting lost in translation.
>
> Your app must have this sort of structure:
>
> app
> |-- __init__.py
> |-- models
> |   |-- __init__.py
> |   |-- auth.py
> |   `-- blogs.py
> `-- views.py
>
>
> If app/models/auth.py defines a User class, and app/models/blogs.py
> defines a Blog class, then in app/views.py you would refer to them
> like this:
>
> from app.models.auth import User
> from app.models.blog import Blog
>
> You cannot refer to them like so:
>
> from app.models import *
>
> unless you first import them into app/models/__init__.py.
>
> This is well documented python semantics; read the python docs for
> more information.
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: not able to recognize non-default python files in app + project directory

2010-06-11 Thread rahul jain
@also I meant .objects. all().

It will give import error that  cannot be imported.



On Fri, Jun 11, 2010 at 7:09 AM, rahul jain <jainwolver...@gmail.com> wrote:
> Yes I have the __init__.py inside my app directory. Also, all my split
> files are inside the same directory. If possible can you test
>
> Create views1.py (not views.py)
>>
>> import your model class
>>
>> and in one of the functions do
>> .objects. all()
>>
>> and then run python manage.py runserver. I think it will break.
>
>
>
> --RJ
>
> On Fri, Jun 11, 2010 at 7:04 AM, rahul jain <jainwolver...@gmail.com> wrote:
>> @bruno: yes functions.
>>
>> So in some other file I want to use models methods like
>>
>> .objects. all
>>
>> For that I have to import the  . But I am not able to.
>>
>> Import works fine on views.py
>>
>> Also, can you test this for me
>>
>> Create views1.py (not views.py)
>>
>> import your model class
>>
>> and in one of the functions do
>> .objects. all
>>
>> and then run python manage.py runserver. I think it will break.
>>
>> Let me know what i am missing or will __initial__.py will solve this
>> problem   ?.
>>
>>
>>
>>
>>
>> On Fri, Jun 11, 2010 at 6:53 AM, rahul jain <jainwolver...@gmail.com> wrote:
>>> Yes they are in the same directory. How to use __initial__.py ?
>>>
>>> On Fri, Jun 11, 2010 at 3:38 AM, Scott Gould <zinck...@gmail.com> wrote:
>>>> Did you put Test1.py and Test2.py into a "models" directory where
>>>> models.py would normally be, and add an __initial__.py file to it?
>>>>
>>>> On Jun 10, 5:18 pm, rahul jain <jainwolver...@gmail.com> wrote:
>>>>> HI Dan,
>>>>>
>>>>> Thanks for your response but that will not solve my problem.
>>>>>
>>>>> I am not splitting models. I am splitting actions defined in the
>>>>> models  across multiple files.
>>>>>
>>>>> So suppose
>>>>>
>>>>> one of my model actions is calling which in turn calls the constructor
>>>>> or simple functions defined in normal python files
>>>>>
>>>>> for ex:
>>>>>
>>>>> def action (self, request, queryset):
>>>>>
>>>>>     Test1()     //calls default constructor of the class
>>>>>     Test2()
>>>>>
>>>>> Now each of these are separate class files names as Test1.py Test2.py.
>>>>>
>>>>> In each of these files i want to do this
>>>>>
>>>>> from ..models import 
>>>>>
>>>>> But I get this error
>>>>>
>>>>> ImportError: cannot import name 
>>>>>
>>>>> I tired various other variotions like just
>>>>>
>>>>> from models import 
>>>>>
>>>>> from .models import 
>>>>>
>>>>> or without from
>>>>>
>>>>> but none of them are working.
>>>>>
>>>>> Also, in order to call this Test1() I thought if  I import
>>>>> Test1 in models then it will just work but again not
>>>>>
>>>>> --RJ
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Jun 10, 2010 at 1:57 PM, Dan Harris <dih0...@gmail.com> wrote:
>>>>> > When you split things out into multiple files or directories you have
>>>>> > to remember to import them into the models.py file or the __init__.py
>>>>> > file (if using a directory).
>>>>>
>>>>> > So if i had some models in a new file "extraModels.py" for example
>>>>>
>>>>> > # In extraModels.py
>>>>> > class ExtraModel(models.Model):
>>>>> >    pass
>>>>>
>>>>> > Then in the regular "models.py"
>>>>>
>>>>> > # In models.py
>>>>> > from extraModels import ExtraModel
>>>>>
>>>>> > class RegularModels(model.Model):
>>>>> >   pass
>>>>>
>>>>> > The key is that you ahve to import any models in your split files into
>>>>> > your normal models.py file. This is because Django looks for models in
>>>>> > the models.py file only. If you make a m

Re: not able to recognize non-default python files in app + project directory

2010-06-11 Thread rahul jain
Yes I have the __init__.py inside my app directory. Also, all my split
files are inside the same directory. If possible can you test

Create views1.py (not views.py)
>
> import your model class
>
> and in one of the functions do
> .objects. all()
>
> and then run python manage.py runserver. I think it will break.



--RJ

On Fri, Jun 11, 2010 at 7:04 AM, rahul jain <jainwolver...@gmail.com> wrote:
> @bruno: yes functions.
>
> So in some other file I want to use models methods like
>
> .objects. all
>
> For that I have to import the  . But I am not able to.
>
> Import works fine on views.py
>
> Also, can you test this for me
>
> Create views1.py (not views.py)
>
> import your model class
>
> and in one of the functions do
> .objects. all
>
> and then run python manage.py runserver. I think it will break.
>
> Let me know what i am missing or will __initial__.py will solve this
> problem   ?.
>
>
>
>
>
> On Fri, Jun 11, 2010 at 6:53 AM, rahul jain <jainwolver...@gmail.com> wrote:
>> Yes they are in the same directory. How to use __initial__.py ?
>>
>> On Fri, Jun 11, 2010 at 3:38 AM, Scott Gould <zinck...@gmail.com> wrote:
>>> Did you put Test1.py and Test2.py into a "models" directory where
>>> models.py would normally be, and add an __initial__.py file to it?
>>>
>>> On Jun 10, 5:18 pm, rahul jain <jainwolver...@gmail.com> wrote:
>>>> HI Dan,
>>>>
>>>> Thanks for your response but that will not solve my problem.
>>>>
>>>> I am not splitting models. I am splitting actions defined in the
>>>> models  across multiple files.
>>>>
>>>> So suppose
>>>>
>>>> one of my model actions is calling which in turn calls the constructor
>>>> or simple functions defined in normal python files
>>>>
>>>> for ex:
>>>>
>>>> def action (self, request, queryset):
>>>>
>>>>     Test1()     //calls default constructor of the class
>>>>     Test2()
>>>>
>>>> Now each of these are separate class files names as Test1.py Test2.py.
>>>>
>>>> In each of these files i want to do this
>>>>
>>>> from ..models import 
>>>>
>>>> But I get this error
>>>>
>>>> ImportError: cannot import name 
>>>>
>>>> I tired various other variotions like just
>>>>
>>>> from models import 
>>>>
>>>> from .models import 
>>>>
>>>> or without from
>>>>
>>>> but none of them are working.
>>>>
>>>> Also, in order to call this Test1() I thought if  I import
>>>> Test1 in models then it will just work but again not
>>>>
>>>> --RJ
>>>>
>>>>
>>>>
>>>> On Thu, Jun 10, 2010 at 1:57 PM, Dan Harris <dih0...@gmail.com> wrote:
>>>> > When you split things out into multiple files or directories you have
>>>> > to remember to import them into the models.py file or the __init__.py
>>>> > file (if using a directory).
>>>>
>>>> > So if i had some models in a new file "extraModels.py" for example
>>>>
>>>> > # In extraModels.py
>>>> > class ExtraModel(models.Model):
>>>> >    pass
>>>>
>>>> > Then in the regular "models.py"
>>>>
>>>> > # In models.py
>>>> > from extraModels import ExtraModel
>>>>
>>>> > class RegularModels(model.Model):
>>>> >   pass
>>>>
>>>> > The key is that you ahve to import any models in your split files into
>>>> > your normal models.py file. This is because Django looks for models in
>>>> > the models.py file only. If you make a models directory, you have to
>>>> > import all models you want Django to recognize into your __init__.py
>>>> > file within the models directory.
>>>>
>>>> > Hopefully this makes sense, if not I can try to be more clear.
>>>>
>>>> > Dan Harris
>>>> > dih0...@gmail.com
>>>>
>>>> > On Jun 10, 4:46 pm, rahul jain <jainwolver...@gmail.com> wrote:
>>>> >> anyone on this ??
>>>>
>>>> >> --RJ
>>>>
>>>> >> On Thu, Jun 10, 2010 at 11:34 AM, rahul jain <j

Re: not able to recognize non-default python files in app + project directory

2010-06-11 Thread rahul jain
@bruno: yes functions.

So in some other file I want to use models methods like

.objects. all

For that I have to import the  . But I am not able to.

Import works fine on views.py

Also, can you test this for me

Create views1.py (not views.py)

import your model class

and in one of the functions do
.objects. all

and then run python manage.py runserver. I think it will break.

Let me know what i am missing or will __initial__.py will solve this
problem   ?.





On Fri, Jun 11, 2010 at 6:53 AM, rahul jain <jainwolver...@gmail.com> wrote:
> Yes they are in the same directory. How to use __initial__.py ?
>
> On Fri, Jun 11, 2010 at 3:38 AM, Scott Gould <zinck...@gmail.com> wrote:
>> Did you put Test1.py and Test2.py into a "models" directory where
>> models.py would normally be, and add an __initial__.py file to it?
>>
>> On Jun 10, 5:18 pm, rahul jain <jainwolver...@gmail.com> wrote:
>>> HI Dan,
>>>
>>> Thanks for your response but that will not solve my problem.
>>>
>>> I am not splitting models. I am splitting actions defined in the
>>> models  across multiple files.
>>>
>>> So suppose
>>>
>>> one of my model actions is calling which in turn calls the constructor
>>> or simple functions defined in normal python files
>>>
>>> for ex:
>>>
>>> def action (self, request, queryset):
>>>
>>>     Test1()     //calls default constructor of the class
>>>     Test2()
>>>
>>> Now each of these are separate class files names as Test1.py Test2.py.
>>>
>>> In each of these files i want to do this
>>>
>>> from ..models import 
>>>
>>> But I get this error
>>>
>>> ImportError: cannot import name 
>>>
>>> I tired various other variotions like just
>>>
>>> from models import 
>>>
>>> from .models import 
>>>
>>> or without from
>>>
>>> but none of them are working.
>>>
>>> Also, in order to call this Test1() I thought if  I import
>>> Test1 in models then it will just work but again not
>>>
>>> --RJ
>>>
>>>
>>>
>>> On Thu, Jun 10, 2010 at 1:57 PM, Dan Harris <dih0...@gmail.com> wrote:
>>> > When you split things out into multiple files or directories you have
>>> > to remember to import them into the models.py file or the __init__.py
>>> > file (if using a directory).
>>>
>>> > So if i had some models in a new file "extraModels.py" for example
>>>
>>> > # In extraModels.py
>>> > class ExtraModel(models.Model):
>>> >    pass
>>>
>>> > Then in the regular "models.py"
>>>
>>> > # In models.py
>>> > from extraModels import ExtraModel
>>>
>>> > class RegularModels(model.Model):
>>> >   pass
>>>
>>> > The key is that you ahve to import any models in your split files into
>>> > your normal models.py file. This is because Django looks for models in
>>> > the models.py file only. If you make a models directory, you have to
>>> > import all models you want Django to recognize into your __init__.py
>>> > file within the models directory.
>>>
>>> > Hopefully this makes sense, if not I can try to be more clear.
>>>
>>> > Dan Harris
>>> > dih0...@gmail.com
>>>
>>> > On Jun 10, 4:46 pm, rahul jain <jainwolver...@gmail.com> wrote:
>>> >> anyone on this ??
>>>
>>> >> --RJ
>>>
>>> >> On Thu, Jun 10, 2010 at 11:34 AM, rahul jain <jainwolver...@gmail.com> 
>>> >> wrote:
>>> >> > Hi Django,
>>>
>>> >> > In my app directory, I splitted my models and views.py into multiple
>>> >> > files since they start becoming very long but django is not able to
>>> >> > recognize those files .
>>> >> > It only recognizes models.py, views.py, tests.py (default ones).
>>>
>>> >> > So In my other files If i do this
>>>
>>> >> > from ..models import 
>>>
>>> >> > I get this error
>>>
>>> >> > ImportError: cannot import name 
>>>
>>> >> > If I do the same on views.py, it just works fine.
>>>
>>> >> > Even on Eclipse I can see Django default files with different symbol

Re: not able to recognize non-default python files in app + project directory

2010-06-11 Thread rahul jain
Yes they are in the same directory. How to use __initial__.py ?

On Fri, Jun 11, 2010 at 3:38 AM, Scott Gould <zinck...@gmail.com> wrote:
> Did you put Test1.py and Test2.py into a "models" directory where
> models.py would normally be, and add an __initial__.py file to it?
>
> On Jun 10, 5:18 pm, rahul jain <jainwolver...@gmail.com> wrote:
>> HI Dan,
>>
>> Thanks for your response but that will not solve my problem.
>>
>> I am not splitting models. I am splitting actions defined in the
>> models  across multiple files.
>>
>> So suppose
>>
>> one of my model actions is calling which in turn calls the constructor
>> or simple functions defined in normal python files
>>
>> for ex:
>>
>> def action (self, request, queryset):
>>
>>     Test1()     //calls default constructor of the class
>>     Test2()
>>
>> Now each of these are separate class files names as Test1.py Test2.py.
>>
>> In each of these files i want to do this
>>
>> from ..models import 
>>
>> But I get this error
>>
>> ImportError: cannot import name 
>>
>> I tired various other variotions like just
>>
>> from models import 
>>
>> from .models import 
>>
>> or without from
>>
>> but none of them are working.
>>
>> Also, in order to call this Test1() I thought if  I import
>> Test1 in models then it will just work but again not
>>
>> --RJ
>>
>>
>>
>> On Thu, Jun 10, 2010 at 1:57 PM, Dan Harris <dih0...@gmail.com> wrote:
>> > When you split things out into multiple files or directories you have
>> > to remember to import them into the models.py file or the __init__.py
>> > file (if using a directory).
>>
>> > So if i had some models in a new file "extraModels.py" for example
>>
>> > # In extraModels.py
>> > class ExtraModel(models.Model):
>> >    pass
>>
>> > Then in the regular "models.py"
>>
>> > # In models.py
>> > from extraModels import ExtraModel
>>
>> > class RegularModels(model.Model):
>> >   pass
>>
>> > The key is that you ahve to import any models in your split files into
>> > your normal models.py file. This is because Django looks for models in
>> > the models.py file only. If you make a models directory, you have to
>> > import all models you want Django to recognize into your __init__.py
>> > file within the models directory.
>>
>> > Hopefully this makes sense, if not I can try to be more clear.
>>
>> > Dan Harris
>> > dih0...@gmail.com
>>
>> > On Jun 10, 4:46 pm, rahul jain <jainwolver...@gmail.com> wrote:
>> >> anyone on this ??
>>
>> >> --RJ
>>
>> >> On Thu, Jun 10, 2010 at 11:34 AM, rahul jain <jainwolver...@gmail.com> 
>> >> wrote:
>> >> > Hi Django,
>>
>> >> > In my app directory, I splitted my models and views.py into multiple
>> >> > files since they start becoming very long but django is not able to
>> >> > recognize those files .
>> >> > It only recognizes models.py, views.py, tests.py (default ones).
>>
>> >> > So In my other files If i do this
>>
>> >> > from ..models import 
>>
>> >> > I get this error
>>
>> >> > ImportError: cannot import name 
>>
>> >> > If I do the same on views.py, it just works fine.
>>
>> >> > Even on Eclipse I can see Django default files with different symbol
>> >> > and python files with different symbols.
>>
>> >> > How to solve this problem ?
>>
>> >> > --RJ
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "Django users" group.
>> > To post to this group, send email to django-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: not able to recognize non-default python files in app + project directory

2010-06-10 Thread rahul jain
anyone on this ??

--RJ

On Thu, Jun 10, 2010 at 11:34 AM, rahul jain <jainwolver...@gmail.com> wrote:
> Hi Django,
>
> In my app directory, I splitted my models and views.py into multiple
> files since they start becoming very long but django is not able to
> recognize those files .
> It only recognizes models.py, views.py, tests.py (default ones).
>
> So In my other files If i do this
>
> from ..models import 
>
> I get this error
>
> ImportError: cannot import name 
>
> If I do the same on views.py, it just works fine.
>
> Even on Eclipse I can see Django default files with different symbol
> and python files with different symbols.
>
> How to solve this problem ?
>
> --RJ
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: not able to recognize non-default python files in app + project directory

2010-06-10 Thread rahul jain
HI Dan,

Thanks for your response but that will not solve my problem.

I am not splitting models. I am splitting actions defined in the
models  across multiple files.

So suppose

one of my model actions is calling which in turn calls the constructor
or simple functions defined in normal python files

for ex:

def action (self, request, queryset):

Test1() //calls default constructor of the class
Test2()

Now each of these are separate class files names as Test1.py Test2.py.

In each of these files i want to do this

from ..models import 

But I get this error

ImportError: cannot import name 

I tired various other variotions like just

from models import 

from .models import 

or without from

but none of them are working.

Also, in order to call this Test1() I thought if  I import
Test1 in models then it will just work but again not

--RJ



On Thu, Jun 10, 2010 at 1:57 PM, Dan Harris <dih0...@gmail.com> wrote:
> When you split things out into multiple files or directories you have
> to remember to import them into the models.py file or the __init__.py
> file (if using a directory).
>
> So if i had some models in a new file "extraModels.py" for example
>
> # In extraModels.py
> class ExtraModel(models.Model):
>    pass
>
> Then in the regular "models.py"
>
> # In models.py
> from extraModels import ExtraModel
>
> class RegularModels(model.Model):
>   pass
>
> The key is that you ahve to import any models in your split files into
> your normal models.py file. This is because Django looks for models in
> the models.py file only. If you make a models directory, you have to
> import all models you want Django to recognize into your __init__.py
> file within the models directory.
>
> Hopefully this makes sense, if not I can try to be more clear.
>
> Dan Harris
> dih0...@gmail.com
>
>
> On Jun 10, 4:46 pm, rahul jain <jainwolver...@gmail.com> wrote:
>> anyone on this ??
>>
>> --RJ
>>
>>
>>
>> On Thu, Jun 10, 2010 at 11:34 AM, rahul jain <jainwolver...@gmail.com> wrote:
>> > Hi Django,
>>
>> > In my app directory, I splitted my models and views.py into multiple
>> > files since they start becoming very long but django is not able to
>> > recognize those files .
>> > It only recognizes models.py, views.py, tests.py (default ones).
>>
>> > So In my other files If i do this
>>
>> > from ..models import 
>>
>> > I get this error
>>
>> > ImportError: cannot import name 
>>
>> > If I do the same on views.py, it just works fine.
>>
>> > Even on Eclipse I can see Django default files with different symbol
>> > and python files with different symbols.
>>
>> > How to solve this problem ?
>>
>> > --RJ
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



not able to recognize non-default python files in app + project directory

2010-06-10 Thread rahul jain
Hi Django,

In my app directory, I splitted my models and views.py into multiple
files since they start becoming very long but django is not able to
recognize those files .
It only recognizes models.py, views.py, tests.py (default ones).

So In my other files If i do this

from ..models import 

I get this error

ImportError: cannot import name 

If I do the same on views.py, it just works fine.

Even on Eclipse I can see Django default files with different symbol
and python files with different symbols.

How to solve this problem ?

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



how to fetch query string in the view

2010-06-09 Thread rahul jain
HI Django,

So I am generating a url of the form

http://test/?test1=test=test

In my views how to process the query string ?test1=test=test.  I
mean how to access test1 and test2 values.

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



removing "All" from django admin filters

2010-06-09 Thread rahul jain
Hi Django,

I would like to remove  "All" from filters. It becomes very confusing
when i change back and forth between pages. Since it always gets back
to "All" instead of keeping the state.

Whats a clean way to do it ?

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django's default id (auto primary key) sorting

2010-06-08 Thread rahul jain
Hi Django,

I tried lots of different ways to get my ids listed in ascending order
(1 - x). But it always displays id's (x -1).

This is what I tried

So, I am talking about auto increment id which is generated by default
by Django.

on models admin
ordering = ('-id',)

also i tried

on class meta

order_by = ('-id',)

This is only happening with auto-increment primary key i.e id. Not
with others. Manually I can set it by going to admin
and then sorting. But I need to set the default ascending order
sorting for id's.

Is it a bug or something I am missing.

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ordering objects in the admin area

2010-06-08 Thread rahul jain
Could this be used to retrieve new objects first ?.

On Tue, Jun 8, 2010 at 6:41 AM, Alessandro Pasotti  wrote:
> 2010/6/8 grimmus 
>>
>> Hi,
>>
>> I have a staff app that lists staff photos and their names. The client
>> would like to be able to re-order these in the admin area easily.
>> Ideally there would be a dropdown where the user could select between
>> 1 and n which object should appear in what position in the list.
>>
>> I could add an extra integer field to the model, but how would i
>> initially populate it with a value ? And how would the dropdown work
>> in the admin area ?
>>
>> Thank you for any tips/advice.
>
> Hi,
> I'm not sure if this is the same problem, but what I did is to use a Mixin
> like this:
> djangosnippets.org/snippets/259/
> then, in a custom change_list.html template I used JQuery sortable to drag
> and drop items, when an item is dropped to the new position, an ajax call in
> the background calls a custom view that saves the new order (the method is
> just one: insert_at called with the new position as argument).
>
> --
> Alessandro Pasotti
> w3:   www.itopen.it
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



no checkboxes for read only objects

2010-06-07 Thread rahul jain
Hi Django,

Is this possible ?

On change list page, I would like to provide check boxes only for the
objects which could be effected by admin actions.
But for some of the objects I would not like to provide admin actions
since I don't wont them to be modified.

check box if we can modify the object, otherwise not.

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: new objects display first on admin filter display

2010-06-07 Thread rahul jain
Hi Daniel,

New objects first on the filter display, but my filter is applied on Charfield.

So for ex: , I am creating like suppose x number of objects with a
field with value key_timestamp (charfield).

Then I am creating a filter on the CharField. I am not sure how its
implementing it but its displaying (key_timetamp) in a reverse order
(I mean older to newest). I was expecting it to be a random order
since its a charfield. So I would like it to display newly created
key_timestamp first. So that I can get all the new objects with that
timestamp.

--RJ

On Mon, Jun 7, 2010 at 1:17 AM, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Jun 7, 4:35 am, rahul jain <jainwolver...@gmail.com> wrote:
>> Hi Django,
>>
>> How to display ordering on admin filter in reverse order. Its a char Field
>>
>> I would like to display new objects created first.
>>
>
> Well, which? Do you want it reverse sorted by your charfield? Or do
> you want to display new objects first? Those two seem to be opposing
> requirements.
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



new objects display first on admin filter display

2010-06-06 Thread rahul jain
Hi Django,

How to display ordering on admin filter in reverse order. Its a char Field

I would like to display new objects created first.

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django and android application

2010-06-05 Thread rahul jain
Hi Django,

I would like to create an android application which talks to Django.
If I hit a url on my phone, it hits one of my views (urlconf), that
view
processes the request and give the result back to the android app.

Anybody in the community have any knowledge how to proceed with it

Firstlty, how to hit my Django server from android application

Secondly, how to send back the results.

Any tips, suggestions and design help will be appreciated.

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: admin modifications

2010-06-04 Thread rahul jain
Hi Daniel,

Yes I know about admin actions but I would like to provide a select
option/modify button on every rows inside my admin display. Not just
at one place.

--RJ

On Wed, Jun 2, 2010 at 1:05 AM, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Jun 2, 7:56 am, rahul jain <jainwolver...@gmail.com> wrote:
>> Hi Django,
>>
>> I am not sure how this could be done, so on the admin display, on one
>> of the columns I would like to provide select tab. If i select one of
>> the options,
>> it should update some other column on the display.
>>
>> Firstly, whats the clean way for adding select boxes on the admin
>> display, it could be one of the columns
>>
>> Secondly, if i select one of those options, could I do it without
>> hitting any server, the ajax way.
>>
>> --RJ
>
> Admin actions are what you need:
> http://docs.djangoproject.com/en/1.2/ref/contrib/admin/actions/
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



admin modifications

2010-06-02 Thread rahul jain
Hi Django,

I am not sure how this could be done, so on the admin display, on one
of the columns I would like to provide select tab. If i select one of
the options,
it should update some other column on the display.

Firstly, whats the clean way for adding select boxes on the admin
display, it could be one of the columns

Secondly, if i select one of those options, could I do it without
hitting any server, the ajax way.

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django python pi-charts/graphs

2010-06-02 Thread rahul jain
Hi Django,

I would like to represent my db/model content in the form of
pi-charts/graphs. Is there any django python module that already
exists ?

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django problems

2010-05-31 Thread rahul jain
Hi Django,

I have few questions and would like to seek your help.


Q1) I have defined lot of admin actions and some of the actions
require creating threads. So I split my long models.py into set of
files. But whenever I try to import anything from models
python complains ?

ex: if i have defined model name

class Test(models.Model):
blah blah

In my second file, I tried importing this class by using following

from models import Test

from app_name.models import Test

but none of them work.I am not sure why ?

Q2) Also, I have split my admin functions into set of functions

func1(){

   func2()

}


and in func2 (), if something bad happens

I would like to do self.message_user (request,"Bad") and then exit.

Right now i have to do return

But once it return back to func1() then it keeps on adding more of
those messages defined inside func1 ().

So how to do the redirect inside func2 () so that it simply exits and
displays just one message on admin.


Q3)Thirdly list_ordering dosent work for django default id. So i am
using django id (autoincrement primary key)

and would like to display in other way around like it should start
from 1 ---100 not from 100  ---1 on display.

so i tried this on admin model

lordering = ('-id',)

but it complains the id does not exist which exists though but not
defined by me.

Q4) how to change the theme for my django admin ?

Thanks for your help.

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-admin-tools

2010-05-31 Thread rahul jain
Hi David,

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', 'your_em...@domain.com'),
)

MANAGERS = ADMINS



DATABASE_ENGINE = 'mysql'   # 'postgresql_psycopg2',
'postgresql', 'mysql', 'sqlite3' or 'oracle'.


# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = '/Users/---/Documents/---/media'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com;, "http://example.com/media/;
MEDIA_URL = ''

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/;, "/media/".
ADMIN_MEDIA_PREFIX = '/media/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = '---'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.csrf.middleware.CsrfMiddleware',
)

ROOT_URLCONF = '---.urls'

TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or
"C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
"mytemplates",
)

TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.auth',
'django.core.context_processors.request',
)


INSTALLED_APPS = (
'admin_tools',
'admin_tools.theming',
'admin_tools.menu',
'admin_tools.dashboard',
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.contenttypes',
'---.---',
'django.contrib.databrowse'

)

and then if  i do "" ls -ln media """ inside my root project directory,

admin_tools -> /Library/Python/2.6/site-packages/admin_tools/media/admin_tools



urls.py

from django.conf.urls.defaults import *
from django.contrib import databrowse


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

urlpatterns = patterns('',
# Example:
# (r'^---/', include('---.foo.urls')),

# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
(r'^admin_tools/', include('admin_tools.urls')),
(r'^data/(.*)', databrowse.site.root),

)

My guess is documentation is wrong.I think admin_tools media folder
should be inside django.contrib.admin.

--RJ


On Sun, May 30, 2010 at 10:55 AM, izi <izimo...@gmail.com> wrote:
> Hi,
>
> On 30 mai, 08:43, rahul jain <jainwolver...@gmail.com> wrote:
>> Hi Django,
>>
>> Anybody able to ran django-admin-tools successfully. I followed the
>> instructions from this website
>>
>> http://packages.python.org/django-admin-tools/0.2.0/quickstart.html#q...
>>
>> I was expecting a new theme for dashboard and index page after hitting
>> admin link but its still the same.
>>
>
> If you followed the quickstart step by step it should work.
> Please give more information about your settings, urls, the version of
> django you are using, etc.
>
> Note: django-admin-tools has its own mailing list so you should post
> there :
> http://groups.google.com/group/django-admin-tools/
>
> Regards,
>
> --
> David
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this grou

django-admin-tools

2010-05-30 Thread rahul jain
Hi Django,

Anybody able to ran django-admin-tools successfully. I followed the
instructions from this website

http://packages.python.org/django-admin-tools/0.2.0/quickstart.html#quickstart

I was expecting a new theme for dashboard and index page after hitting
admin link but its still the same.

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



disabling dashboard 'recent actions'

2010-05-26 Thread rahul jain
Hi Django,

How to disable the dashboard ('recent actions') on django admin main page ?

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Just one action on all the objects

2010-05-26 Thread rahul jain
Hi Django,

Can i run an action without any need to select all. It should by
default select everything, basically all the objects. No separate
checkbox for every object, no select all.
Also, possibly no choices, just a single button which say "action"
which should perform that action on all the objects.

for ex:

HTML Button say "Delete" on the top of change list page. When I hit it
performs delete operation on all the objects.

I need it because I want to perform just one action on all the objects.

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



view permission on django admin

2010-05-24 Thread rahul jain
Hi Django,

I know this has been discussed lot of times but not implemented on
admin because django developers think that django admin will not be
just used for viewing.

Anyways, I need it for my model.

I went through the path but was not able to solve this problem.

http://code.djangoproject.com/ticket/7150

I think this patch is for some old code

Here what its missing

a/django/contrib/admin/sites.py
old new 
281 281 'add': 
model_admin.has_add_permission(request),
282 282 'change':
model_admin.has_change_permission(request),
283 283 'delete':
model_admin.has_delete_permission(request),
284 'view': 
model_admin.has_view_permission(request),
284 285 }
285 286 
286 287 # Check whether user has any perm for this 
module.

I checked sites.py but none of the above exists now.

Anyone know the recent patch for this.

Thanks.

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: is it possible ?

2010-05-23 Thread rahul jain
Hi Daniel,

I think this will solve this problem

if i have a boolean field in my model and if I would like to display
only if that fileld id true to the non-super users and otherwise
always show the boolean field.

But my question was

how to disable the select all widget from the admin panel if the user
is non-super user. The select all widget helps in selecting all the
objects but since my action is empty, i dont want to show any widget.

Also, I am not sure why we need this as well

def change_view(self, request, object_id, extra_context=None):
if Part.objects.get(id=object_id).is_deleted==True and
request.user.is_superuser == False:
return HttpResponseRedirect('/admin/')
else:
return super(PartAdmin, self).change_view(request,
object_id,extra_context=None)

Thanks.

--RJ





2010/5/21 Danfi <tda...@gmail.com>:
> ChangeList is in the file /python**/Lib/site-packages/django/contrib/
> admin/views/main.py ,and we use ModelAdmin so change_view function can
> direct to be used.
>
> On 5月21日, 下午2时08分, rahul jain <jainwolver...@gmail.com> wrote:
>> Hi Danfi,
>>
>> Thanks for your quick response. But can you explain a little more how
>> can we connect ChangeList class with that function change_view.
>> Confuse about it.
>>
>> --RJ
>>
>> 2010/5/20 Danfi <tda...@gmail.com>:
>>
>>
>>
>> > In Auth group you can create a group and set the limits.
>>
>> > see different panel maybe use changelist_view
>>
>> > I saw this just be similar to yours'
>>
>> > class Part(models.Model):
>> > is_deleted = models.BooleanField()
>> > //
>> > class PartAdmin(admin.ModelAdmin):
>> > actions =None
>> > def change_view(self, request, object_id, extra_context=None):
>> > if Part.objects.get(id=object_id).is_deleted==True and
>> > request.user.is_superuser == False:
>> > return HttpResponseRedirect('/admin/')
>> > else:
>> > return super(PartAdmin, self).change_view(request,
>> > object_id,extra_context=None)
>>
>> > /
>> > edit admin/views/main.py
>> > IS_DELETED_VAR = 'is_deleted'
>>
>> > class ChangeList(object):
>> > def __init__(self, request, model, list_display, list_display_links,
>> > list_filter, date_hierarchy, search_fields, list_select_related,
>> > list_per_page, list_editable, model_admin):
>> > self.model = model
>> > self.opts = model._meta
>> > self.lookup_opts = self.opts
>> > self.root_query_set = model_admin.queryset(request)
>> >  try:
>> > f =self.lookup_opts.get_field(IS_DELETED_VAR)
>> > except models.FieldDoesNotExist:
>> > self.root_query_set = self.root_query_set
>> > else:
>> > if isinstance(f,models.BooleanField) and (request.user.is_superuser ==
>> > False):
>> > self.root_query_set = self.root_query_set.exclude(is_deleted = 'True')
>> > else:
>> > self.root_query_set = self.root_query_set
>>
>> > On 5月21日, 下午12时01分, rahul jain <jainwolver...@gmail.com> wrote:
>> >> Hi Everyone,
>>
>> >> I would like to implement different views in admin panel based on the 
>> >> user.
>>
>> >> if the user is any other user apart from admin
>>
>> >> then for all those models, the user should just be able to see those
>> >> objects,( no change, delete and add).
>> >> Those users should also not see the select boxes or basically select all.
>>
>> >> So by default django provides three permissions, add, delete,change. I
>> >> would like to add one more permission on admin panel.
>>
>> >> I know this could be done on our own views through this
>>
>> >> class USCitizen(models.Model):
>> >> # ...
>> >> class Meta:
>> >> permissions = (
>> >> ("can_drive", "Can drive"),
>> >> ("can_vote", "Can vote in elections"),
>> >> ("can_drink", "Can drink alcohol"),
>> >> )
>>
>> >> {% if perms.foo %}
>> >> You have permission to do something in the foo app.
>> >> {% if perms.foo.can_vote %}
>> >> You can vote!
>> >> {% endif %}
>> >> {% if perms.foo.can_drive %}
>> >> You can drive!
>> >> {% endif %}
>> >> {% else %}
>> >> You don't have permission to do a

Re: is it possible ?

2010-05-21 Thread rahul jain
Hi Danfi,

Thanks for your quick response. But can you explain a little more how
can we connect ChangeList class with that function change_view.
Confuse about it.

--RJ



2010/5/20 Danfi <tda...@gmail.com>:
> In Auth group you can create a group and set the limits.
>
> see different panel maybe use changelist_view
>
> I saw this just be similar to yours'
>
> class Part(models.Model):
> is_deleted = models.BooleanField()
> //
> class PartAdmin(admin.ModelAdmin):
> actions =None
> def change_view(self, request, object_id, extra_context=None):
> if Part.objects.get(id=object_id).is_deleted==True and
> request.user.is_superuser == False:
> return HttpResponseRedirect('/admin/')
> else:
> return super(PartAdmin, self).change_view(request,
> object_id,extra_context=None)
>
> /
> edit admin/views/main.py
> IS_DELETED_VAR = 'is_deleted'
>
> class ChangeList(object):
> def __init__(self, request, model, list_display, list_display_links,
> list_filter, date_hierarchy, search_fields, list_select_related,
> list_per_page, list_editable, model_admin):
> self.model = model
> self.opts = model._meta
> self.lookup_opts = self.opts
> self.root_query_set = model_admin.queryset(request)
>  try:
> f =self.lookup_opts.get_field(IS_DELETED_VAR)
> except models.FieldDoesNotExist:
> self.root_query_set = self.root_query_set
> else:
> if isinstance(f,models.BooleanField) and (request.user.is_superuser ==
> False):
> self.root_query_set = self.root_query_set.exclude(is_deleted = 'True')
> else:
> self.root_query_set = self.root_query_set
>
> On 5月21日, 下午12时01分, rahul jain <jainwolver...@gmail.com> wrote:
>> Hi Everyone,
>>
>> I would like to implement different views in admin panel based on the user.
>>
>> if the user is any other user apart from admin
>>
>> then for all those models, the user should just be able to see those
>> objects,( no change, delete and add).
>> Those users should also not see the select boxes or basically select all.
>>
>> So by default django provides three permissions, add, delete,change. I
>> would like to add one more permission on admin panel.
>>
>> I know this could be done on our own views through this
>>
>> class USCitizen(models.Model):
>> # ...
>> class Meta:
>> permissions = (
>> ("can_drive", "Can drive"),
>> ("can_vote", "Can vote in elections"),
>> ("can_drink", "Can drink alcohol"),
>> )
>>
>> {% if perms.foo %}
>> You have permission to do something in the foo app.
>> {% if perms.foo.can_vote %}
>> You can vote!
>> {% endif %}
>> {% if perms.foo.can_drive %}
>> You can drive!
>> {% endif %}
>> {% else %}
>> You don't have permission to do anything in the foo app.
>> {% endif %}
>>
>> But how to do the same thing on the django admin. Also, how to remove
>> the select all functionality for selected users.
>>
>> --RJ
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group 
>> athttp://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



is it possible ?

2010-05-20 Thread rahul jain
Hi Everyone,

I would like to implement different views in admin panel based on the user.

if the user is any other user apart from admin

then for all those models, the user should just be able to see those
objects,( no change, delete and add).
Those users should also not see the select boxes or basically select all.

So by default django provides three permissions, add, delete,change. I
would like to add one more permission on admin panel.

I know this could be done on our own views through this

class USCitizen(models.Model):
# ...
class Meta:
permissions = (
("can_drive", "Can drive"),
("can_vote", "Can vote in elections"),
("can_drink", "Can drink alcohol"),
)


{% if perms.foo %}
You have permission to do something in the foo app.
{% if perms.foo.can_vote %}
You can vote!
{% endif %}
{% if perms.foo.can_drive %}
You can drive!
{% endif %}
{% else %}
You don't have permission to do anything in the foo app.
{% endif %}


But how to do the same thing on the django admin. Also, how to remove
the select all functionality for selected users.

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django filters

2010-05-19 Thread rahul jain
Hi,

In my model, I have set up one filter which helps in filtering out the
results on admin Panel. The way its works now
that its displays the old objects first and then the most recent ones. Is it
possible to make it other way around ?.

Let me know.

--RJ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ANN: Django 1.1.2 and Django 1.2 released

2010-05-17 Thread rahul jain
Awesome job...but I discovered just one problem. Select all missing from
admin panel. So now i cannot select all the objects if i want to from admin
panel. It was fine on django 1.1. Its not fine on django 1.2 nor in the
development versions.

--RJ

On Mon, May 17, 2010 at 7:11 PM, Joshua Partogi wrote:

> I have just read through the release notes, and really amazed how
> django 1.2 has evolved from 1.1.
>
> Kudos to everyone that is involved and put all effort into delivering
> django 1.2
>
>
> Kind regards,
> Joshua
>
>
> On May 18, 9:46 am, Continuation  wrote:
> > Congrats to the Django team.
> >
> > Thanks for the great job. Really appreciate all your work.
> >
> > On May 17, 2:19 pm, James Bennett  wrote:
> >
> >
> >
> > > We're pleased today to announce the release of both Django 1.1.2 --
> > > the second bugfix release in the 1.1 series -- and the long-awaited
> > > Django 1.2.
> >
> > > More information is available over at djangoproject.com:
> >
> > > * Django 1.1.2 release announcement:
> http://www.djangoproject.com/weblog/2010/may/17/112/
> > > * Django 1.1.2 release notes:
> http://docs.djangoproject.com/en/1.1/releases/1.1.2/
> > > * Django 1.2 release announcement:
> http://www.djangoproject.com/weblog/2010/may/17/12/
> > > * Django 1.2 release notes:
> http://docs.djangoproject.com/en/dev/releases/1.2/
> >
> > > --
> > > "Bureaucrat Conrad, you are technically correct -- the best kind of
> correct."
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups "Django users" group.
> > > To post to this group, send email to django-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> > > For more options, visit this group athttp://
> groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.