can .values() return the field of child model

2009-09-04 Thread Subramanyam

Hi

Can .values() method return fields of child model  i.e fields of
forward relation across a database

---
Subramanyam
--~--~-~--~~~---~--~~
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: best approach for using email as username

2009-10-30 Thread Subramanyam
Hi

Firstly you can try using  the following auth-backend
http://www.djangosnippets.org/snippets/74/

secondly
while rendering the signup form to the user
you can write a clean method in your signnup form like

def clean_email(self):
try:
user=User.objects.get(email__exact=self.cleaned_data["email"])
raise forms.ValidationError(u"A user already is subscribed to
this email, please choose another email ID")
except User.DoesNotExist:
# email is unique


return self.cleaned_data["email"]


On Fri, Oct 30, 2009 at 7:24 PM, wancharle sebastiao quirino <
wancha...@gmail.com> wrote:

> Hi,
>
> The unique problem is username = email.
>
> You could create auth backend for login with email but email != username
>
> I use:
>  http://code.google.com/p/django-profile/
>
> In django-profile login is with username and email is opcional...
> But i add email auth backend and user can login with your email if
> registred.
>
>
>
> ps.: i dont speak english
>
> 2009/10/29 Adrián Ribao 
>
>
>> Hello,
>>
>> I need to use the email field as the username. I neet these:
>>
>> * Email must be unique
>> * I should authenticate against the email
>> * The admin should work I I should be able to create users with
>> username = email address.
>>
>> I have a custom authentication method but I need more. I need to tell
>> Django to make the email unique, and I need to login and create users
>> from the admin with the @ character.
>>
>> What is the best approach for this?
>>
>> I've been searching in google but no one of the solutions can
>> accomplish the three points I need.
>>
>> Thank you!
>>
>> Adrian.
>>
>>
>
> >
>


-- 
Regards
Subramanyam

--~--~-~--~~~---~--~~
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: best approach for using email as username

2009-10-30 Thread Subramanyam
small correction

On Fri, Oct 30, 2009 at 7:41 PM, Subramanyam  wrote:

> Hi
>
> Firstly you can try using  the following auth-backend
> http://www.djangosnippets.org/snippets/74/
>
> secondly
> while rendering the signup form to the user
> you can write a clean method in your signnup form like
>
> def clean_email(self):
> try:
> user=User.objects.get(email__exact=self.cleaned_data["email"])
> raise forms.ValidationError(u"A user already is subscribed to
> this email, please choose another email ID")
> except User.DoesNotExist:
> # email is unique
>
pass

>
>
> return self.cleaned_data["email"]
>
>
>
> On Fri, Oct 30, 2009 at 7:24 PM, wancharle sebastiao quirino <
> wancha...@gmail.com> wrote:
>
>> Hi,
>>
>> The unique problem is username = email.
>>
>> You could create auth backend for login with email but email != username
>>
>> I use:
>>  http://code.google.com/p/django-profile/
>>
>> In django-profile login is with username and email is opcional...
>> But i add email auth backend and user can login with your email if
>> registred.
>>
>>
>>
>> ps.: i dont speak english
>>
>> 2009/10/29 Adrián Ribao 
>>
>>
>>> Hello,
>>>
>>> I need to use the email field as the username. I neet these:
>>>
>>> * Email must be unique
>>> * I should authenticate against the email
>>> * The admin should work I I should be able to create users with
>>> username = email address.
>>>
>>> I have a custom authentication method but I need more. I need to tell
>>> Django to make the email unique, and I need to login and create users
>>> from the admin with the @ character.
>>>
>>> What is the best approach for this?
>>>
>>> I've been searching in google but no one of the solutions can
>>> accomplish the three points I need.
>>>
>>> Thank you!
>>>
>>> Adrian.
>>>
>>>
>>
>> >>
>>
>
>
> --
> Regards
> Subramanyam
>



-- 
Regards
Subramanyam

--~--~-~--~~~---~--~~
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: My http://localhost/admin/ display

2010-06-13 Thread Subramanyam

Hi

The problem is that the css files are not being rendered in the path
that you mentioned
to try debugging further do a find in your media folder to list the
css files if you dont find them , then you found the problem

Regards
Subramanyam

On Jun 13, 9:11 pm, Jagdeep Singh Malhi 
wrote:
> i am use this commands many time , it does not make any effect .
>
> On Jun 13, 12:12 am, Rolando Espinoza La Fuente 
> wrote:
>
>
>
> > On Sat, Jun 12, 2010 at 12:58 PM, Jagdeep Singh Malhi
>
> >  wrote:
> > > Myhttp://localhost/admin/ is display in  pattern without grapic or
> > > image not  like that which is shown in Tutorial
> > >http://docs.djangoproject.com/en/1.2/intro/tutorial02/#intro-tutorial02
>
> > > MY admin page (http://localhost/admin/)
>
> > > Django administration
> > > Welcome, Jagdeep. Change password / Log out
> > > Site administration
> > >   Auth
> > > Groups  Add     Change
> > > Users   Add     Change
> > >    Polls
> > > Polls   Add     Change
> > >    Sites
> > > Sites   Add     Change
>
> > > Recent Actions
> > > My Actions
>
> > > where is the problem .i am not able to find???
>
> > Using manage.py runserver you shouldn't have this problem.
> > runserver command takes care of admin styles.
>
> i am use this commands many time , it does not make any effect .
>
> > Are you using apache as webserver?
>
> > ~Rolando

-- 
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: Plese guide to solve this

2010-07-21 Thread Subramanyam
Hi

In your models.py

Change the below to
name = models.CharField(maxlength=30)
this
name = models.CharField(max*_*length=30)
underscore is the diff


Regards
Subramanyam


On Wed, Jul 21, 2010 at 6:30 PM, balu  wrote:

> Respected sir
>
> This is balu studying B.Tech third year. I started working on django
> in order to create dynamic website. My Python version is 2.6.5. While
> I'm using creating a app the following error has displayed in the
> command line.
>
>
> /
>
> */
>
> Microsoft Windows XP [Version 5.1.2600]
> (C) Copyright 1985-2001 Microsoft Corp.
>
> C:\Documents and Settings\Administrator>cd c:\
>
> C:\>cd projects
>
> C:\projects>manage.py startapp books
> 'manage.py' is not recognized as an internal or external command,
> operable program or batch file.
>
> C:\projects>cd mysite
>
> C:\projects\mysite>python manage.py startapp books
>
> C:\projects\mysite>cd books
>
> C:\projects\mysite\books>div
> 'div' is not recognized as an internal or external command,
> operable program or batch file.
>
> C:\projects\mysite\books>dir
>  Volume in drive C has no label.
>  Volume Serial Number is 3474-4CF2
>
>  Directory of C:\projects\mysite\books
>
> 07/21/2010  04:59 PM  .
> 07/21/2010  04:59 PM  ..
> 07/21/2010  04:59 PM60 models.py
> 07/21/2010  04:59 PM   537 tests.py
> 07/21/2010  04:59 PM27 views.py
> 07/21/2010  04:59 PM 0 __init__.py
>   4 File(s)624 bytes
>   2 Dir(s)  27,813,937,152 bytes free
>
> C:\projects\mysite\books>cd C:\projects\mysite
>
> C:\projects\mysite>python manage.py validate
> Traceback (most recent call last):
>  File "manage.py", line 11, in 
>execute_manager(settings)
>  File "C:\python26\lib\site-packages\django\core\management
> \__init__.py", line
> 438, in execute_manager
>utility.execute()
>  File "C:\python26\lib\site-packages\django\core\management
> \__init__.py", line
> 379, in execute
>self.fetch_command(subcommand).run_from_argv(self.argv)
>  File "C:\python26\lib\site-packages\django\core\management\base.py",
> line 191,
>  in run_from_argv
>self.execute(*args, **options.__dict__)
>  File "C:\python26\lib\site-packages\django\core\management\base.py",
> line 218,
>  in execute
>output = self.handle(*args, **options)
>  File "C:\python26\lib\site-packages\django\core\management\base.py",
> line 347,
>  in handle
>return self.handle_noargs(**options)
>  File "C:\python26\lib\site-packages\django\core\management\commands
> \validate.p
> y", line 9, in handle_noargs
>self.validate(display_num_errors=True)
>  File "C:\python26\lib\site-packages\django\core\management\base.py",
> line 245,
>  in validate
>num_errors = get_validation_errors(s, app)
>  File "C:\python26\lib\site-packages\django\core\management
> \validation.py", lin
> e 28, in get_validation_errors
>for (app_name, error) in get_app_errors().items():
>  File "C:\python26\lib\site-packages\django\db\models\loading.py",
> line 146, in
>  get_app_errors
>self._populate()
>  File "C:\python26\lib\site-packages\django\db\models\loading.py",
> line 61, in
> _populate
>self.load_app(app_name, True)
>  File "C:\python26\lib\site-packages\django\db\models\loading.py",
> line 78, in
> load_app
>models = import_module('.models', app_name)
>  File "C:\python26\lib\site-packages\django\utils\importlib.py", line
> 35, in im
> port_module
>__import__(name)
>  File "C:\projects\mysite\..\mysite\books\models.py", line 5, in
> 
>class Publisher(models.Model):
>  File "C:\projects\mysite\..\mysite\books\models.py", line 6, in
> Publisher
>name = models.CharField(maxlength=30)
>  File "C:\python26\lib\site-packages\django\db\models\fields
> \__init__.py", line
>  542, in __init__
>super(CharField, self).__init__(*args, **kwargs)
> TypeError: __init__() got an unexpected keyword argument 'maxlength'
>
> C:\projects\mysite>
>
> /
>
> **/
>
> I'm very thankful to you if anyone could able to direct me to solve
> this error.
>
> Thanking you
> balu.
>
> --
> 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.



Alphabetic filtering of Django Admin drop down menu

2010-12-07 Thread Subramanyam
Hi All

In one of tables that we access through the Admin menu we have around
50,000 objects which return string o/p as the return value, but the
problem is that it takes too long for them to load ( more than few
minutes)  in a drop down

I have also gone through the raw_id_fields but it doesn't fit our
requirement

Is there a way that we can have alphabetic pagination in the drop down
menu of Admin



Thanks in advance
Subramanyam



-- 
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.



obtaining sessionId(s) of logged in user by username

2009-12-31 Thread Subramanyam
Hi

what is the most efficient way to get the sessionId(s) of a user by
the username  (where in the same user can  log-in on mulitple
systems)  , btw the I am using sessionID as the key for my cached
objects

Is there any middleware that I can use

Thanks
Subramanyam

--

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: obtaining sessionId(s) of logged in user by username

2010-01-01 Thread Subramanyam
Hi

Found a pointer which I feel is more relevant to my question
http://stackoverflow.com/questions/235950/how-to-lookup-django-session-for-a-particular-user

Will update on the solution after I get/develop one :)

Regards
Subramanyam


On Thu, Dec 31, 2009 at 9:37 AM, Subramanyam  wrote:

> Hi
>
> what is the most efficient way to get the sessionId(s) of a user by
> the username  (where in the same user can  log-in on mulitple
> systems)  , btw the I am using sessionID as the key for my cached
> objects
>
> Is there any middleware that I can use
>
> Thanks
> Subramanyam

--

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.




error using memcache and filter()

2010-01-06 Thread Subramanyam
Hi

I am using memcached for caching objects , but am stuck with the
following

When I use the .all() method it works fine
>> from django.core.cache import cache
>>> user_list=User.objects.all()[0:10]
>>> key='userlist'
>>> cache.set(key,user_list)


But when I use .filter() method I get the following error

>>> user_list=User.objects.filter(is_staff=False)[0:10]
>>> key='userlist'
>>> cache.set(key,user_list)
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/bvemu/lib/python2.6/site-packages/django/core/cache/
backends/memcached.py", line 37, in set
self._cache.set(smart_str(key), value, timeout or
self.default_timeout)
  File "/home/bvemu/lib/python2.6/site-packages/python_memcached-1.45-
py2.6.egg/memcache.py", line 515, in set
return self._set("set", key, val, time, min_compress_len)
  File "/home/bvemu/lib/python2.6/site-packages/python_memcached-1.45-
py2.6.egg/memcache.py", line 725, in _set
store_info = self._val_to_store_info(val, min_compress_len)
  File "/home/bvemu/lib/python2.6/site-packages/python_memcached-1.45-
py2.6.egg/memcache.py", line 697, in _val_to_store_info
pickler.dump(val)
PicklingError: Can't pickle : attribute lookup
django.utils.functional.__proxy__ failed


please let me know if anyone has seen the error before


Thanks
Subramanyam
-- 
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: error using memcache and filter()

2010-01-06 Thread Subramanyam
Thanks a LOT !! Frank

Further to your analysis I checked the following
http://docs.djangoproject.com/en/dev/topics/serialization/#serializing-dataand
understood from the note (rather my understanding ) that only .all()
query set method  would give the serialized data

if we want .filter () ( or any other queryset methods didn`t check them all
)  we have to serialize/de-serialize the queryset

Did the following and it worked

from django.core import serializers
cache.set('test1',serializers.serialize("json",User.objects.filter(is_staff=False)[0:10]))

there on I deserialize again to get the objects back


Thanks again !!


Regards
Subramanyam


On Wed, Jan 6, 2010 at 8:42 AM, Frank DiRocco  wrote:

> 'yam,
>
> I have not seen this error, but my responses to the error are inline.
>
>
> On Jan 6, 2010, at 6:30 AM, Subramanyam wrote:
>
>  File "/home/bvemu/lib/python2.6/site-packages/django/core/cache/
>> backends/memcached.py", line 37, in set
>>   self._cache.set(smart_str(key), value, timeout or
>> self.default_timeout)
>>
>
> So it appears your issue originates when you call cache.set(key,user_list)
>
>
>   File "/home/bvemu/lib/python2.6/site-packages/python_memcached-1.45-
>> py2.6.egg/memcache.py", line 515, in set
>>   return self._set("set", key, val, time, min_compress_len)
>>  File "/home/bvemu/lib/python2.6/site-packages/python_memcached-1.45-
>> py2.6.egg/memcache.py", line 725, in _set
>>   store_info = self._val_to_store_info(val, min_compress_len)
>>  File "/home/bvemu/lib/python2.6/site-packages/python_memcached-1.45-
>> py2.6.egg/memcache.py", line 697, in _val_to_store_info
>>   pickler.dump(val)
>> PicklingError: Can't pickle > 'django.utils.functional.__proxy__'>: attribute lookup
>> django.utils.functional.__proxy__ failed
>>
>
> But from these last three lines you can deduce that "Can't pickle" is
> telling you the object is not unserializable (only in the failing case). So,
> when we reflect back on the point at which you populated the val you passed
> to the cache backend you will probably find:
>
>
>  user_list=User.objects.all()[0:10]
>>>>
>>>
> produces a list of objects that are serializable (ie, your superuser
> account)
>
> and
>
>
>  user_list=User.objects.filter(is_staff=False)[0:10]
>>>>
>>>
> is returning an unserializable value possibly? (although pickle.dump([],
> some_object) succeeds, serializing an empty list)
>
> I would have to say it seems like you are passing unexpected data to the
> cacher that is not being validated as serializable and the pickler is
> failing to serialize the invalid data. But this is, just a guess...
>
>
> --
> 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: Hosting for Django sites

2010-04-06 Thread Subramanyam
Hi

Did you use memcache in deployment in the shared plans

Regards
Subramanyam


On Sun, Apr 4, 2010 at 9:54 PM, Justin Myers  wrote:

> I'm a fan of Webfaction's shared plans, and I've used them for three
> or four projects now. I've had no problems with their support, and
> they even did a pretty good job keeping everyone informed when they
> were affected by that big explosion at The Planet's datacenter a
> couple of years ago (http://tech.slashdot.org/article.pl?
> sid=08/06/01/1715247). That said, even though their servers are
> physically in the US, my credit card bill shows that they're in the
> UK--so I end up with the fun foreign transaction surcharge every time
> Webfaction bills me.
>
> I've also spent the last few months on a Rackspace Cloud server for a
> project, and I've got no complaints. Setting it up and getting
> everything configured were more involved, of course, but that's to be
> expected (as Ray said).
>
> As Shawn mentioned earlier, Webfaction's control panel makes it easy
> to set up subdomains and media URLs (so much easier to me than mucking
> around in httpd.conf and the like), and I like the backup features in
> Rackspace's control panel. Overall, I'd say you can't go wrong with
> either, honestly.
>
> HTH,
> Justin
>
> On Apr 3, 5:35 pm, shofty  wrote:
> > +1 for webfaction.
> >
> > this is a +1 from a proper noob. they were very helpful to me when i
> > was struggling my way through my first django site, so if you're on a
> > real steep learning curve, they will help you out.
> >
> > im not so sure for the 24/7 phone support, i raised an issue with them
> > on twitter once and they sorted it there and then. plus im uk based so
> > phone wouldn't really help.
> >
> > Matt
> >
> > On Apr 3, 9:47 pm, django_jedi  wrote:
> >
> > > Thanks guys.  Very helpful.  Confirming my research.  We've been using
> > > Webfaction for a couple of sites to test drive them, and they come
> > > through w/flying colors.
> >
> > > The only thing I'd like to see from them is 24/7 phone support (hey,
> > > I'm not asking for much, am I? ;-)
>
> --
> 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.



Query on Instant Messaging

2007-10-24 Thread Subramanyam

Hi

Do we have any libraries in django to provide instant messaging or are
there any open source project that we can integrate it into our web
server (Django-server ) and provide instant messaging

Just like what gmail has, some web-page based messaging between
contacts of the same domain users


Thanks in advance

Subramanyam


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Call for reviews on the django book !!

2007-11-29 Thread Subramanyam

Hi All

I am planning to buy the "The Definitive Guide to Django: Web
Development Done Right" by Adrian Holovaty , Jacob Kaplan-Moss

Can you please share your reviews like , is it the same as the django
book available in the www.djangoproject.com or does it include more
coverages of code snippets.

btw I have to place an international order since it is not available
in the Asian Edition


Thanks in advance
Subramanyam

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Call for reviews on the django book !!

2007-11-29 Thread Subramanyam

Hi kenneth

I was referring to the paper edition

On Nov 30, 12:15 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> On 30-Nov-07, at 12:22 PM, Subramanyam wrote:
>
> > Can you please share your reviews like , is it the same as the django
> > book available in thewww.djangoproject.comor does it include more
> > coverages of code snippets.
>
> look at it here and make up your mind:http://www.djangobook.com/
>
> --
>
> regards
> kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/
> Foss Conference for the common man:http://registration.fossconf.in/web/
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Call for reviews on the django book !!

2007-11-29 Thread Subramanyam

Better dont assume and answer

let me know if you have gone through the book

On Nov 30, 12:26 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> On 30-Nov-07, at 12:52 PM, Subramanyam wrote:
>
> > I was referring to the paper edition
>
> what is there in the site will be there on paper and vice versa
>
> --
>
> regards
> kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/
> Foss Conference for the common man:http://registration.fossconf.in/web/
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



unique_together modifed after data is loaded

2013-08-27 Thread Subramanyam

Hi
 
Initially when we created the table we had two fields as unique_together = 
( 'field1',field2') and quite some data has been added with the same

Later we added one more field to unique_together = ( 
'field1',field2','field3')

how can I flush the old indexes created and add the new ones


Thanks
-Subramanyam


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


help required on how to modify constraints/indexes of unique_together after data is loaded

2013-08-27 Thread Subramanyam

Hi
 
Initially when we created the table we had two fields as unique_together = 
( 'field1',field2') and quite some data has been added with the same

Later we added one more field to unique_together = ( 
'field1',field2','field3')

how can I flush the old constraints/indexes created and add the new ones


Thanks
-Subramanyam

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


Re: help required on how to modify constraints/indexes of unique_together after data is loaded

2013-08-28 Thread Subramanyam

Hi

Found the solution 
 ran the following sql directly and it worked fine 

ALTER TABLE  `table_name` 
DROP INDEX `field1` 
, ADD UNIQUE INDEX `field1` (`field1` ASC, `field2` ASC, `field3` ASC) ; 


Also checked a distinct on the three fields to ensure data integrity 


Thanks
Subramanyam


On Tuesday, August 27, 2013 5:52:05 PM UTC+5:30, Subramanyam wrote:
>
>
> Hi
>  
> Initially when we created the table we had two fields as unique_together = 
> ( 'field1',field2') and quite some data has been added with the same
>
> Later we added one more field to unique_together = ( 
> 'field1',field2','field3')
>
> how can I flush the old constraints/indexes created and add the new ones
>
>
> Thanks
> -Subramanyam
>

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


Re: What's your workflow?

2010-12-22 Thread Subramanyam
Hi

After working on couple of big projects I felt the best way to start on
django once you have the basic setup ready is

1.) Have a complete list of the features into your requirement documents
if its not possible and you want a agile development methodology split
into features that makes sense w.r.t sub-releases

2.) understand what all external django apps you may need and go through
their documentation as well

3.) Create the db model as completely as possible i.e include any future
fields that you need, or you feel could be important for you project,
 addressing in the first go would be great
( I messed up DB modelling and I had to redo quite some )

4.) Start working on the views page by page w.r.t the requirement

5.) Have the unit test case after you are done ( or even before you develop
if you are using TDD model )

6.) once you feel complete then go for selenium , deployment automation, ...
and the rest


Subramanyam


On Thu, Dec 23, 2010 at 12:10 AM, Dana  wrote:

> I've been bashing my head against a wall lately trying to determine
> the best (highly subjective, I know) workflow for developing Django
> projects.
>
> What I have gathered so far is:
>
> * Buildout -- For building and packaging your projects.
> * Fabric -- For easy deployment/testing of code on devel/staging/
> production servers
> * PIP -- For installing Python packages into your project.
> * virtualenv -- For creating an isolated Python environment.
>
> ... but what I am having trouble figuring out is how the workflow
> should be between these tools.
>
> * What's the relationship between PIP and buildout in development vs.
> deployment?
> * Is buildout used solely for installing/packaging stuff for
> deployment?
> * Do you use fabric to run buildout on a server?
> * What role does PIP requirements file play in all this? Is it used?
> * Are you using setuptools or distribute?
>
> I know this is a very broad and subjective topic but I'd love to hear
> what you guys and gals are doing out there to develop rapidly and to
> deploy efficiently and predictably.
>
> Cheers
>
> --
> 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: What's your workflow?

2010-12-22 Thread Subramanyam
hi Dana


On Thu, Dec 23, 2010 at 12:51 AM, Dana  wrote:

> Subramanyam, thanks for the response.
>
> In regard to 3, I am not clear why it would be a good idea to add in
> model fields for things you *think* you might want some day.
>
> I would think that using Django South or something similar to create
> SQL migrations for your model after a change would be a cleaner
> solution... I don't like the idea of adding fields to a model that I
> will not use right away as it adds cruft and complexity to my models
> and makes it so determining what is being used and what is not more
> difficult. Also, since you would be planning for the future, there is
> a good chance things will change so much that it would render those
> fields obsolete or inaccurate.
>

My point exactly is to lessen the changes that one may want to say I can do
them later and that ends up being a daunting task later
( personally we have re factored much of the code that way)

The fields I mentioned are mostly relation for tables that would be part of
your project but which are required to be implemented later

South is a good tool, but my point is its better not to get to the point
that we have to use South
( Invariably we end up with that its a different case )

Regarding changes of DB, we dont want to predict that there may be many
changes, that I dont know now,  instead I feel it should be "I have
estimated all of the project`s DB schema now as per the features and dont
need anymore unless the features are completely changed

- Subramanyam

>
> Do you use PIP, virtualenv or any of the other tools I mentioned in my
> first post?
>
> Cheers
>
> On Dec 22, 11:12 am, Subramanyam  wrote:
> > Hi
> >
> > After working on couple of big projects I felt the best way to start on
> > django once you have the basic setup ready is
> >
> > 1.) Have a complete list of the features into your requirement documents
> > if its not possible and you want a agile development methodology
> split
> > into features that makes sense w.r.t sub-releases
> >
> > 2.) understand what all external django apps you may need and go through
> > their documentation as well
> >
> > 3.) Create the db model as completely as possible i.e include any future
> > fields that you need, or you feel could be important for you project,
> >  addressing in the first go would be great
> > ( I messed up DB modelling and I had to redo quite some )
> >
> > 4.) Start working on the views page by page w.r.t the requirement
> >
> > 5.) Have the unit test case after you are done ( or even before you
> develop
> > if you are using TDD model )
> >
> > 6.) once you feel complete then go for selenium , deployment automation,
> ...
> > and the rest
> >
> > Subramanyam
> >
> > On Thu, Dec 23, 2010 at 12:10 AM, Dana  wrote:
> > > I've been bashing my head against a wall lately trying to determine
> > > the best (highly subjective, I know) workflow for developing Django
> > > projects.
> >
> > > What I have gathered so far is:
> >
> > > * Buildout -- For building and packaging your projects.
> > > * Fabric -- For easy deployment/testing of code on devel/staging/
> > > production servers
> > > * PIP -- For installing Python packages into your project.
> > > * virtualenv -- For creating an isolated Python environment.
> >
> > > ... but what I am having trouble figuring out is how the workflow
> > > should be between these tools.
> >
> > > * What's the relationship between PIP and buildout in development vs.
> > > deployment?
> > > * Is buildout used solely for installing/packaging stuff for
> > > deployment?
> > > * Do you use fabric to run buildout on a server?
> > > * What role does PIP requirements file play in all this? Is it used?
> > > * Are you using setuptools or distribute?
> >
> > > I know this is a very broad and subjective topic but I'd love to hear
> > > what you guys and gals are doing out there to develop rapidly and to
> > > deploy efficiently and predictably.
> >
> > > Cheers
> >
> > > --
> > > 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: What's your workflow?

2010-12-27 Thread Subramanyam
hi

On Fri, Dec 24, 2010 at 10:32 AM, Dana  wrote:

> @Subramanyam
>
> > South is a good tool, but my point is its better not to get to the point
> > that we have to use South.
>
> Why do you think South is a fallback rather than part of your toolset?
> From what I can see it is a great tool and adds a lot of great
> features to a Django developers arsenal.
>

South is a good tool no doubt about that
my point from is that from a development point of view we are re-doing some
task/fixing some issues or working on an enhancement which requires
migration from the old data and nothing to belittle south

-Subramanyam


>
>
> On Dec 22, 12:41 pm, Subramanyam  wrote:
> > hi Dana
> >
> > On Thu, Dec 23, 2010 at 12:51 AM, Dana  wrote:
> > > Subramanyam, thanks for the response.
> >
> > > In regard to 3, I am not clear why it would be a good idea to add in
> > > model fields for things you *think* you might want some day.
> >
> > > I would think that using Django South or something similar to create
> > > SQL migrations for your model after a change would be a cleaner
> > > solution... I don't like the idea of adding fields to a model that I
> > > will not use right away as it adds cruft and complexity to my models
> > > and makes it so determining what is being used and what is not more
> > > difficult. Also, since you would be planning for the future, there is
> > > a good chance things will change so much that it would render those
> > > fields obsolete or inaccurate.
> >
> > My point exactly is to lessen the changes that one may want to say I can
> do
> > them later and that ends up being a daunting task later
> > ( personally we have re factored much of the code that way)
> >
> > The fields I mentioned are mostly relation for tables that would be part
> of
> > your project but which are required to be implemented later
> >
> > South is a good tool, but my point is its better not to get to the point
> > that we have to use South
> > ( Invariably we end up with that its a different case )
> >
> > Regarding changes of DB, we dont want to predict that there may be many
> > changes, that I dont know now,  instead I feel it should be "I have
> > estimated all of the project`s DB schema now as per the features and dont
> > need anymore unless the features are completely changed
> >
> > - Subramanyam
> >
> >
> >
> > > Do you use PIP, virtualenv or any of the other tools I mentioned in my
> > > first post?
> >
> > > Cheers
> >
> > > On Dec 22, 11:12 am, Subramanyam  wrote:
> > > > Hi
> >
> > > > After working on couple of big projects I felt the best way to start
> on
> > > > django once you have the basic setup ready is
> >
> > > > 1.) Have a complete list of the features into your requirement
> documents
> > > > if its not possible and you want a agile development methodology
> > > split
> > > > into features that makes sense w.r.t sub-releases
> >
> > > > 2.) understand what all external django apps you may need and go
> through
> > > > their documentation as well
> >
> > > > 3.) Create the db model as completely as possible i.e include any
> future
> > > > fields that you need, or you feel could be important for you project,
> > > >  addressing in the first go would be great
> > > > ( I messed up DB modelling and I had to redo quite some )
> >
> > > > 4.) Start working on the views page by page w.r.t the requirement
> >
> > > > 5.) Have the unit test case after you are done ( or even before you
> > > develop
> > > > if you are using TDD model )
> >
> > > > 6.) once you feel complete then go for selenium , deployment
> automation,
> > > ...
> > > > and the rest
> >
> > > > Subramanyam
> >
> > > > On Thu, Dec 23, 2010 at 12:10 AM, Dana 
> wrote:
> > > > > I've been bashing my head against a wall lately trying to determine
> > > > > the best (highly subjective, I know) workflow for developing Django
> > > > > projects.
> >
> > > > > What I have gathered so far is:
> >
> > > > > * Buildout -- For building and packaging your projects.
> > > > > * Fabric -- For easy deployment/testing of code on devel/staging/
> > > > > production servers
> > > > > * PIP -- For installing Python packages into your pr

kwargs not available in ListView

2016-06-17 Thread Subramanyam
If we subclass ListView and try to override the get_content_data in 1.8.11 
kwargs are not showing up,  is this a bug ??

I have seen a bug already but I am not sure whether 
https://code.djangoproject.com/ticket/17242 is to be revisited

Bala

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


Re: Django and chat

2009-07-06 Thread Subramanyam Vemu
Hi Juanjux

Did you deploy the above chat application in any production site or so
do you have any stats like how many max users it can handle

Thanks in advance

Regards
Subramanyam

On Sun, Jul 5, 2009 at 7:54 PM, Juanjux (Google)  wrote:

>
> Hi Ivan,
>
> It's not based on Django, but it's easily embedable on any site and
> works pretty well:
>
> https://blueimp.net/ajax/
>
> On Jul 3, 8:20 am, Ivan Uemlianin  wrote:
> > Xiong
> >
> > Thanks for your comment.  Good questions.
> >
> > I envisage a social networking website, based on Django.  The website
> > will provide a chat facility for users who are logged in: multi-user
> > chatrooms and private chat (I has been thinking of 1-to-1 as a special
> > case of multi-user).  Django-integration because certain chat
> > functions might have to access Django-centric information (eg
> > different types of user displayed differently; perhaps a django
> > moderation module).
> >
> > If there is a standard embeddable thingamajig, that may well be the
> > way to go.  Can you recommend any that would fit the above usage?
> >
> > Best
> >
> > Ivan
> >
> >
> >
> > > Are you looking for a multi-user chatroom, or private chat?  I'm
> > > guessing you want the first, but you included a jabber client in there
> > > as well, which, to my knowledge, only supports 1-to-1 conversations.
> >
> > > The approach I've seen for most sites is to have a web interface to an
> > > irc room, so that you can chat without having an irc client, or with
> > > one, if you prefer.  I know that Rizon just announced an embeddable
> > > client for their network, and a quick google finds all sorts of
> > > different embeddable clients.  What specifically do you need Django-
> > > integration for, as opposed to a standard java/javascript embeddable
> > > thingamajig?
>
> >
>


-- 
Regards
Subramanyam

--~--~-~--~~~---~--~~
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: Session problem

2009-07-27 Thread Subramanyam Vemu
Hi Boris

Can you update the code/snippet that you are using coz I faced a similar
issue while I was working on a project


On Sun, Jul 26, 2009 at 4:06 AM, Boris Ozegovic wrote:

>
> At the moment I am experiencing difficulties with Django session
> middleware.  For some reason, my keys (and with them my objects) are
> vanishing from the session.  Code, in which changes are made, is
> really
> simple and straightforward, and it isn't problem in code.  Also, I use
> session only in this code snippet, and read it elsewhere.
>
> Also, I have noticed that Django is deleting sessions from database?
> How can this be?  If I hit my application, and than Django admin I
> lost my application session?!
>
> Django 1.0.2, Windows XP, MySQL
>
> Apache and Django server, result is the same.
>
> >
>


-- 
Regards
Subramanyam

--~--~-~--~~~---~--~~
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: Retrieving the values from query set

2009-08-02 Thread Subramanyam Vemu
Hi Malcom

The values_list() returns a list of tuples whereas I am looking for a simple
list of the values


On Mon, Aug 3, 2009 at 10:48 AM, Malcolm Tredinnick <
malc...@pointy-stick.com> wrote:

>
> On Sun, 2009-08-02 at 21:59 -0700, bvemu wrote:
> [...]
> > Is there a django way of retrieving only the values as a list  and not
> > the fieldname
>
> Have a look at the values_list() method. That does what you are after.
>
>
> http://docs.djangoproject.com/en/dev/ref/models/querysets/#values-list-fields
>
> Regards,
> Malcolm
>
>
> >
>


-- 
Regards
Subramanyam

--~--~-~--~~~---~--~~
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: Retrieving the values from query set

2009-08-02 Thread Subramanyam Vemu
Hi Daniel ,Malcom

Thanks for the reply
That exactly was the solution I wanted

On Mon, Aug 3, 2009 at 11:47 AM, Daniel Roseman wrote:

>
> On Aug 3, 7:03 am, Subramanyam Vemu  wrote:
> > Hi Malcom
> >
> > The values_list() returns a list of tuples whereas I am looking for a
> simple
> > list of the values
> >
> From the link Malcolm so helpfully provided:
>
> "If you only pass in a single field, you can also pass in the `flat`
> parameter. If True, this will mean the returned results are single
> values, rather than one-tuples."
>
> In other words, that's exactly what you want.
> --
> DR.
> >
>


-- 
Regards
Subramanyam

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



unable Integrating Djongo 1.3.1 with django 2.2.10

2020-03-19 Thread Eswar Subramanyam
Hi 

I opted for Djongo to take advantage of Django ORM with MongoDB..

but while starting the server, i get the following error

AppData\Roaming\Python\Python38\site-packages\django\db\utils.py", line 
121, in load_backend
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: 'djongo' isn't an available 
database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
'mysql', 'oracle', 'postgresql', 'sqlite3'


I have lost a lot of time trying to figure out, and came to a conclusion 
that i cant use ORM on Mongo DB.

Have someone got a clue on what going wrong ?

I dump also all the installed packages

Thanks for your help/

Package   Version
- --
asgiref   3.2.5
bson  0.5.8
certifi   2019.11.28
chardet   3.0.4
dataclasses   0.6
Django2.2.11
django-menu-generator 1.0.4
djongo1.3.1
idna  2.9
mongoengine   0.19.1
pip   20.0.2
pymango   0.1.1
pymongo   3.10.1
python-dateutil   2.8.1
pytz  2019.3
requests  2.23.0
setuptools41.2.0
six   1.14.0
sqlparse  0.2.4
urllib3   1.25.8

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6b10fe72-f834-4eb2-86e9-0595031e4b4a%40googlegroups.com.


Re: unable Integrating Djongo 1.3.1 with django 2.2.10

2020-03-20 Thread Eswar Subramanyam
Hi Khaleel

God bless you and your family too.

I understand your point, but i have only one python 3.8 installed. And
Django version is 2.2.1. other package 1.3.1 isnt Django but Djongo, so i
am not able to figure out where this is issue is cropping up. i cleaned
also the pyharm packages but still doesnt work.

Thank you for your help.

Kind Regards
Es.

On Fri, Mar 20, 2020 at 3:49 AM Khaleel Ahmed H. M. Shariff <
khaleelahme...@gmail.com> wrote:

> Hi Eswar,
> May Peace, Blessings & Mercy of Almighty God be on you!
>
> Short answer, your environment is messed up. Now, let us address who or
> how was it messed up
>
> There are many reasons why you could be getting this error.
> One major issue similar I have frequently faced is in case you have
> multiple versions of Python on the same box. Python 2.x & 3.x installed on
> the same box. Django version 1.x is compatible with Python 2.x.  Python 3.x
> & django 1.x do not work together. In case you have multiple versions of
> Python installed, you may have to tweak the PATH to indicate the
> appropriate directory in the search path ahead of the other directories.
>
> This is probably your reason for the stuff not working as you have both
> 2.2.11 & 1.3.1 of Django installed.
>
> 1. You may be using an IDE like pycharm/spyder/any other IDE. Normally,
> these IDEs try to download packages. In case there is a version mismatch in
> the source of the package, there could be a mess up.
> 2. Your PATH & PYTHONPATH environment variable may not have the relevant
> directory or have a different directory with the same file name ahead of
> the actual file you want loaded.
> 3. You may be using a virtualenv. Try to deactivate & try executing the
> same
>
> Hope this helps.
> Kindly share your experience.
> Thanks in advance.
>
>
> God Bless You!
> God Bless India!!
> --
>
> Love & Regards
> Dr. (h.c.) Khaleel Ahmed H. M.
>
> Managing Director, Tanzanite Realty India Private Limited
>
> +91-9845007864
>
> +91-7829777864
>
> ---
> Human Life is Precious
> Koran Surah Ma'idah Chapter 5 Verse 32:
> If anyone killed a person, not in retaliation of murder, or (and) to
> spread mischief in the land - it would be as if he killed all mankind, & if
> anyone saved a life, it would be as if he saved the life of all mankind.
>
>
> On Fri, Mar 20, 2020 at 2:05 AM Eswar Subramanyam <
> eswar.subraman...@gmail.com> wrote:
>
>> Hi
>>
>> I opted for Djongo to take advantage of Django ORM with MongoDB..
>>
>> but while starting the server, i get the following error
>>
>> AppData\Roaming\Python\Python38\site-packages\django\db\utils.py", line
>> 121, in load_backend
>> raise ImproperlyConfigured(
>> django.core.exceptions.ImproperlyConfigured: 'djongo' isn't an available
>> database backend.
>> Try using 'django.db.backends.XXX', where XXX is one of:
>> 'mysql', 'oracle', 'postgresql', 'sqlite3'
>>
>>
>> I have lost a lot of time trying to figure out, and came to a conclusion
>> that i cant use ORM on Mongo DB.
>>
>> Have someone got a clue on what going wrong ?
>>
>> I dump also all the installed packages
>>
>> Thanks for your help/
>>
>> Package   Version
>> - --
>> asgiref   3.2.5
>> bson  0.5.8
>> certifi   2019.11.28
>> chardet   3.0.4
>> dataclasses   0.6
>> Django2.2.11
>> django-menu-generator 1.0.4
>> djongo1.3.1
>> idna  2.9
>> mongoengine   0.19.1
>> pip   20.0.2
>> pymango   0.1.1
>> pymongo   3.10.1
>> python-dateutil   2.8.1
>> pytz  2019.3
>> requests  2.23.0
>> setuptools41.2.0
>> six   1.14.0
>> sqlparse  0.2.4
>> urllib3   1.25.8
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/6b10fe72-f834-4eb2-86e9-0595031e4b4a%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/6b10fe72-f834-4eb2-86e

Re: unable Integrating Djongo 1.3.1 with django 2.2.10

2020-03-20 Thread Eswar Subramanyam
Hi Khaleel and whoever this may help in the future,


Actually you were right Khaleel, on those lines i checked this thread which 
was useful to me.
https://stackoverflow.com/questions/122327/how-do-i-find-the-location-of-my-python-site-packages-directory

Following which i was stareing at the exception and realised that the clue 
which was in front of me since hours to resolve this issue.Like in Java, 
python gives you the root cause of an exception, but as i was used to Java 
and .Net i didnt realise the annotation used by python.

The exception i was bothered about the exception:
AppData\Roaming\Python\Python38\site-packages\django\db\utils.py", line 
121, in load_backend
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: 'djongo' isn't an available 
database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
'mysql', 'oracle', 'postgresql', 'sqlite3'

Where as python had already listed the root cause which was :

\Python\Python38\site-packages\djongo\database.py", line 2, in 
from pymongo import MongoClient
ModuleNotFoundError: No module named 'pymongo'

The *above exception was the direct cause *of the following exception:

Indeed that's where Khaleel you were right, PyMongo i installed through 
pycharm, which desginated a sitepackage folder that wasnt my user 
site-package...

Hope this helps someone falling into the same trap.

Cheers,
Es.

Le jeudi 19 mars 2020 21:35:52 UTC+1, Eswar Subramanyam a écrit :
>
> Hi 
>
> I opted for Djongo to take advantage of Django ORM with MongoDB..
>
> but while starting the server, i get the following error
>
> AppData\Roaming\Python\Python38\site-packages\django\db\utils.py", line 
> 121, in load_backend
> raise ImproperlyConfigured(
> django.core.exceptions.ImproperlyConfigured: 'djongo' isn't an available 
> database backend.
> Try using 'django.db.backends.XXX', where XXX is one of:
> 'mysql', 'oracle', 'postgresql', 'sqlite3'
>
>
> I have lost a lot of time trying to figure out, and came to a conclusion 
> that i cant use ORM on Mongo DB.
>
> Have someone got a clue on what going wrong ?
>
> I dump also all the installed packages
>
> Thanks for your help/
>
> Package   Version
> - --
> asgiref   3.2.5
> bson  0.5.8
> certifi   2019.11.28
> chardet   3.0.4
> dataclasses   0.6
> Django2.2.11
> django-menu-generator 1.0.4
> djongo1.3.1
> idna  2.9
> mongoengine   0.19.1
> pip   20.0.2
> pymango   0.1.1
> pymongo   3.10.1
> python-dateutil   2.8.1
> pytz  2019.3
> requests  2.23.0
> setuptools41.2.0
> six   1.14.0
> sqlparse  0.2.4
> urllib3   1.25.8
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2419aa99-7535-4bd5-b250-ca38d61b67bd%40googlegroups.com.


Extracting Month from date during a query

2020-03-22 Thread Eswar Subramanyam
I am using MongoDB as underlying DB with Django.

pipeline =  {
'price' : Sum('price'),
'month' : ExtractMonth('dateValue'),
}

queryset = 
ListingBooks.objects.values('dateValue','typeBook').annotate(**pipeline)


Unfortuantely i get a NotImplementError, as if Djongo ORM i use doesnt 
implement this function.


Can anyone hint me on how to keep the grouping by month at this query level 
without having to do it manually at the serverside or client side ?


Thank you

Es. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2630ae13-007d-43fd-adef-5cece7e39b6d%40googlegroups.com.


Problem extracting month Djongo / MongoDB

2020-03-23 Thread Eswar Subramanyam
I am using MongoDB as underlying DB with Django.

pipeline =  {
'price' : Sum('price'),
'month' : ExtractMonth('dateValue'),
}

queryset = 
ListingBooks.objects.values('dateValue','typeBook').annotate(**pipeline)


Unfortuantely i get a NotImplementError, as if Djongo ORM i use doesnt 
implement this function.


Can anyone hint me on how to keep the grouping by month at this query level 
without having to do it manually at the serverside or client side ?


Thank you

Es. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2d814cc7-3a9e-49e5-a963-345ac1d383c6%40googlegroups.com.


Re: Problem extracting month Djongo / MongoDB

2020-03-24 Thread Eswar Subramanyam
Does someone have any idea of any other groups on which i can get help on 
my question ? Thanks. BR Es.

Le lundi 23 mars 2020 16:14:37 UTC+1, Eswar Subramanyam a écrit :
>
> I am using MongoDB as underlying DB with Django.
>
> pipeline =  {
> 'price' : Sum('price'),
> 'month' : ExtractMonth('dateValue'),
> }
>
> queryset = 
> ListingBooks.objects.values('dateValue','typeBook').annotate(**pipeline)
>
>
> Unfortuantely i get a NotImplementError, as if Djongo ORM i use doesnt 
> implement this function.
>
>
> Can anyone hint me on how to keep the grouping by month at this query level 
> without having to do it manually at the serverside or client side ?
>
>
> Thank you
>
> Es. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/797ef8b8-0600-4f25-a710-ad26fb029106%40googlegroups.com.


Instantiating the SQL implementation of Aggregates in Django 1.8

2015-08-14 Thread Ramana Subramanyam
 

I've been working on updating the existing code base that was using Django 
1.6 to Django 1.8. In the process, I've been facing a particular problem 
with aggregates. In this code, *PGDAggregate* class has a method 
*add_to_query* which is intended to instantiate the SQL implementation of 
the aggregate and sets it as a class variable (*aggregate*) which i'd be 
using to call the *as_sql* method in Default SQL 
Aggregate(django/db.models.sql.aggregates.Aggregate) from another file. 

My code (The first file, how I implement aggregate): 

from django.db.models.aggregates import Aggregate from 
django.db.models.sql.aggregates import Aggregate as SQLAggregate class 
PGDAggregate(Aggregate): """ Modified to allow Aggregate functions outside of 
the Django module """ def add_to_query(self, query, alias, col, source, 
is_summary): """Add the aggregate to the nominated query. This method is used 
to convert the generic Aggregate definition into a backend-specific definition. 
* query is the backend-specific query instance to which the aggregate is to be 
added. * col is a column reference describing the subject field of the 
aggregate. It can be an alias, or a tuple describing a table and column name. * 
source is the underlying field or aggregate definition for the column 
reference. If the aggregate is not an ordinal or computed type, this reference 
is used to determine the coerced output type of the aggregate. * is_summary is 
a boolean that is set True if the aggregate is a summary value rather than an 
annotation. """ klass = globals()['%sSQL' % self.name] aggregate = klass(col, 
source=source, is_summary=is_summary, **self.extra) # Validate that the backend 
has a fully supported, correct # implementation of this aggregate 
query.aggregates[alias] = aggregate self.aggregate = aggregate class 
BinSort(PGDAggregate): alias = 'BinSort' name = 'BinSort' class 
BinSortSQL(SQLAggregate): sql_function = '' sql_template = 
'%(function)sFLOOR((IF(%(field)s<%(offset).16f,360,0)+%(field)s-%(offset).16f)/%(bincount).16f)-IF(%(field)s=%(max).16f,1,0)'

This is how I'm trying to use the aggregate attribute(an instance of 
Default SQL Aggregate) from the second file to invoke the *as_sql* method.

sortx = BinSort(xTextString, offset=x, bincount=xbin, max=x1) sorty = 
BinSort(yTextString, offset=y, bincount=ybin, max=y1) 
annotated_query.annotate(x=sortx, y=sorty) cn = connections['default'] qn = 
SQLCompiler(annotated_query.query, cn, 'default').quote_name_unless_alias 
sortx_sql = sortx.aggregate.as_sql(qn, cn)[0] sorty_sql = 
sorty.aggregate.as_sql(qn, cn)[0]

The error that I'm getting(in l:6) in this implementation is, 

exception 'BinSort' object has no attribute 'aggregate'

As steps of debugging, i've tried to check if the BinSort instance has an 
attribute "aggregate", using 

hasattr(sortx, 'aggregate')

which has returned me False. But when I try to check by printing the 
aggregate attribute from inside the add_to_query method, I could very much 
see the attribute getting printed. Also, I've implemented this in the way 
specified in Django 1.8 doc, 
https://github.com/django/django/blob/stable/1.8.x/django/db/models/aggregates.py#L46
 

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


How to pass "--runworker --asgi" to wsgi.py

2023-01-11 Thread Bala Subramanyam Vemu
Hi

I am currently using django channels and have deployed them as well 

However , we currently want to separate the runworker from runserver 

As mentioned in the channels we have to run "python manage.py runserver 
---noworker"

so that all the websocket requests can be handled separately 

how do we pass the arguments  "--runworker" to the wsgi.py, btw we are 
deploying using uwsgi process

Thanks 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/47bb9c0f-e1fd-4c00-a33a-2d9cd85e9706n%40googlegroups.com.


Re: How to pass "--runworker --asgi" to wsgi.py

2023-01-13 Thread Bala Subramanyam Vemu
Thank you  Andréas !

Regards
Bala

On Friday, January 13, 2023 at 3:58:12 PM UTC+5:30 andrea...@hypercode.se 
wrote:

> The simple answer is - you can't.
>
> Django can run in 2 separate ways: Synchronous - via a WSGI server - or 
> asynchronous via an ASGI server. Websocket requests run via ASGI - so you 
> need an ASGI server. You can read the official documentation and see your 
> alternatives here:
> https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/
>
> Regards,
>
> Andréas
>
>
> Den ons 11 jan. 2023 kl 19:41 skrev Bala Subramanyam Vemu <
> balasubram...@gmail.com>:
>
>> Hi
>>
>> I am currently using django channels and have deployed them as well 
>>
>> However , we currently want to separate the runworker from runserver 
>>
>> As mentioned in the channels we have to run "python manage.py runserver 
>> ---noworker"
>>
>> so that all the websocket requests can be handled separately 
>>
>> how do we pass the arguments  "--runworker" to the wsgi.py, btw we are 
>> deploying using uwsgi process
>>
>> Thanks 
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/47bb9c0f-e1fd-4c00-a33a-2d9cd85e9706n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/47bb9c0f-e1fd-4c00-a33a-2d9cd85e9706n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c7089d29-df29-4814-adaf-49c467f0e115n%40googlegroups.com.