Dutch Django Sprint in Amsterdam February 2014

2014-02-24 Thread Daniele Procida
The sprint this weekend was productive - Baptiste lists some commits at 
.

It was also a lot of fun. Thanks to Erik Romijn and the Dutch Django 
Association for organising it, and TravelBird  (they're 
recruiting by the way!) who supported the event and were excellent hosts. And 
of course, thanks to all the sprint participants.

I think there were sprinters who had travelled from at least half a dozen 
different countries. 

Don't miss the next one; it's highly recommended.

Thanks again to everyone who was involved.

Daniele

-- 
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/20140224113335.1186523779%40smtpauth.cf.ac.uk.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django substitute old image of ImageFile

2014-02-24 Thread Fabrizio Alongi
Hi, after I've searched online, and from this reply  
I
 
have wrote this solution by overriding save method of my model class.

def save(self, force_insert=False, force_update=False, using=None, 
update_fields=None):
# if an element exist
if self.id is not None:
current = MyModelClass.objects.get(id=self.id)
if self.image != current.image:
# Delete old image and thumbnail
current.image.delete(save=False)# Set save=False 
because it's saving now.
super(MyModelClass, self).save(force_insert, force_update, using, 
update_fields).

Simple!

-- 
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/d9112e90-fd44-41bc-8710-e0c936082f3c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


post save signal inline admin

2014-02-24 Thread Ali Rıza KELEŞ
Hi,

I have problem with post save signal.

Lets say we have two models Authors and Books. Authors model has a
post save signal: NotifyAuthor

When I save model Book with inline Author, Author's post save signal
does not work. If I save model Author via its own form, the signal
works properly.

Is there any quick / easy fix?

Thanks.

-- 
--
Ali Rıza Keleş

-- 
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/CALOKRKp4mwFM2EpoQMciptxV-Lwx%3DSzAqiWTnGDzjZ_76CP00g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Python

2014-02-24 Thread dravid rahul
*Hi Anyone can help me with this *


I worked as a weblogic administrator and now i am changing to development 
and i am very much interested in python . please suggest me what 
are the things i need to learn more  rather than python to get an I.T job. 
I came to Django but i am in a confusion please help me .

-- 
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/07d17724-fd20-47be-a985-8b4709101dba%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


How to return Random items from a Mongodb Resource

2014-02-24 Thread Anuj Chauhan
Hi Friends,

I need to return random items from a tastypie resource which is 
a resources.MongoEngineResource.

I have already tried using MyClass.objects.all().order_by('?'), but it 
simply keep returning the same rows always. Following is the code of my 
resource.

class MViewSubResponseRandomResource(resources.MongoEngineResource):
class Meta:
queryset = SubResponse.objects.all().filter(asset_type='Photo')
*.order_by('?')*
resource_name = 'mview/random'
allowed_methods = ['get']
authentication = SillyAuthentication()
authorization = SillyAuthorization()

def dehydrate(self, bundle):
resource_uri = self.get_resource_uri(bundle)
bundle.data = {}
bundle.data['id']=bundle.obj.id
bundle.data['file_url']=bundle.obj.file_url
bundle.data['action_type']=bundle.obj.action_type
bundle.data['asset_type']=bundle.obj.asset_type
bundle.data['resource_uri']=resource_uri
bundle.data['end_date']=bundle.obj.end_date
return bundle

def get_object_list(self, request):
workgroup_id=request.REQUEST['wid']
superset_limit=1000
subresponses = SubResponse.objects.all().filter(asset_type='Photo', 
rejected=False, work_group_id=workgroup_id)*.order_by('?')*[:superset_limit]
return subresponses



Regards,
Anuj

-- 
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/36b02a36-4292-4bf9-8647-5fcf4672d84f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Python

2014-02-24 Thread Vernon D. Cole
Python  is a programming 
language.  
The purpose of a programming language is to write applications.

Django is an application written in the Python language. The purpose of 
django is to create, operate, and administer websites.

To learn about django, start with the django introduction 
page. 
It contains, among other things, a list of resources to learn the Python 
language.


On Monday, February 24, 2014 9:27:50 AM UTC+1, dravid rahul wrote:
>
> *Hi Anyone can help me with this *
>
>
> I worked as a weblogic administrator and now i am changing to development 
> and i am very much interested in python . please suggest me what 
> are the things i need to learn more  rather than python to get an I.T job. 
> I came to Django but i am in a confusion please help me .
>

-- 
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/c8b7865c-19ad-46ab-b02f-1e596db4dfbb%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django test client encoding of JSON Booleans

2014-02-24 Thread Daniel Smith
Thank you very much for the help. So it sounds like I just have to suck it 
up and call json.loads() on request.body. 

The 'format=json' thing is related to also using the TastyPie test client. 
I've tried both and forgot where that parameter was used.

Thanks,
Daniel

On Saturday, February 22, 2014 10:56:21 AM UTC-5, Camilo Torres wrote:
>
> On Friday, February 21, 2014 6:14:14 PM UTC-4:30, Daniel Smith wrote:
>>
>> I'm using Django version 1.5.5. Here is a short snippet of the test I'm 
>> writing:
>>
>> from django.test import TestCase
>>
>> class MyTest(TestCase):
>>
>>   def my_test(self):
>> url = ... location of my view ...
>> self.client.post(url, data={'active': False}, format='json')
>>
>>
>> The problem I'm running into is that when I inspect request.POST inside 
>> my view, I get: {'active': [u'False']}. The workaround I have right now is 
>> to use json.loads(request.raw_post_data), but I'm wondering if this is a 
>> bug or if I am just missing something. Any help would be greatly 
>> appreciated.
>>
> Hello,
>
> The test client is not converting the data to json.
>
> 1. In your test module, you must convert the data to json and tell the 
> correct content-type application/json:
> json_data = json.dumps({'active': False})
> data = self.client.post(path=url, data=json_data, 
> content_type='application/json')
>
> I notice that you use a format='json' parameter to post; I can't find 
> anything about that parameter in the documentation or the code. You should 
> use content_type='application/json' instead.
>
> 2. In the views module, you should parse the json data:
> if request.method == 'POST':
> body = request.body.decode('UTF-8')
> json_data = json.loads(body)
> print('views 12', json_data['active'])
>
> Kindly note that you should be using request.body instead of the 
> deprecated raw_post_data.
>
> Regards,
> Camilo
>

-- 
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/3ec8854d-f40b-4cc6-94bc-dc6d927cf60a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


big legacy database with complex many to many relationships

2014-02-24 Thread Sells, Fred
I have to integrate to a large read only legacy mssql database .

The many-to-many tables have a lot of additional fields like start/end dates of 
the relationship and their own naming conventions

Can anyone point me to some links that treat this topic in depth.  I've looked 
at the django book and that's a starting point,

Can anyone point me to some good "how to" links on this that provide some 
details and some pitfalls to watch for.

Thanks

Fred.

-- 
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/DCD75728F460F14586086EA606E8308201192B5406%40ACEVXCHMBX1001.ADVENTISTCORP.NET.
For more options, visit https://groups.google.com/groups/opt_out.


Re: big legacy database with complex many to many relationships

2014-02-24 Thread Javier Guerra Giraldez
On Mon, Feb 24, 2014 at 2:54 PM, Sells, Fred
 wrote:
> I have to integrate to a large read only legacy mssql database .


while certainly it's possible to configure this as a second database
and use the ORM, I've found that it's more work than usually needed.
especially if you already have defined SQL patterns, or worse, stored
procedures.  porting those to ORM means debugging them again...

but there's nothing preventing you from using any Python way to access
that data.  particularly if you're going to treat it as read-only.
just write some utility functions that use ODBC or any other interface
to pull your data and use that in your Django views, or even in your
models.

-- 
Javier

-- 
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/CAFkDaoS1WBGDN80v5J%2BCh%2BXCx_g1SD2obvjG51AqO_YJA0mM7w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Python

2014-02-24 Thread Lachlan Musicman
Other useful tools for Django development are: some sort of server
operating system (Linux is my choice); some sort of webserving
software (Apache, Nginx); virtualization (virtualenv); a Version
Control System (Git, Mercurial, SVN) and a Database (PostgreSQL,
MySQL, SQLite)

All of these technologies make life easier. There are more, but I
would suggest that these are the bedrocks on which you build a web
site.

On 25 February 2014 01:25, Vernon D. Cole  wrote:
> Python is a programming language.  The purpose of a programming language is
> to write applications.
>
> Django is an application written in the Python language. The purpose of
> django is to create, operate, and administer websites.
>
> To learn about django, start with the django introduction page. It contains,
> among other things, a list of resources to learn the Python language.
>
>
>
> On Monday, February 24, 2014 9:27:50 AM UTC+1, dravid rahul wrote:
>>
>> Hi Anyone can help me with this 
>>
>>
>> I worked as a weblogic administrator and now i am changing to development
>> and i am very much interested in python . please suggest me what are
>> the things i need to learn more  rather than python to get an I.T job. I
>> came to Django but i am in a confusion please help me .
>
> --
> 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/c8b7865c-19ad-46ab-b02f-1e596db4dfbb%40googlegroups.com.
>
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
>From this perspective it is natural that anarchism be marked by
spontaneity, differentiation, and experimentation that it be marked by
an expressed affinity with chaos, if chaos is understood to be what
lies outside or beyond the dominant game or system. Because of the
resistance to definition and categorisation, the anarchist principle
has been variously interpreted as, rather than an articulated
position, “a moral attitude, an emotional climate, or even a mood”.
This mood hangs in dramatic tension between utopian hope or dystopian
nihilism...
-
http://zuihitsu.org/godspeed-you-black-emperor-and-the-politics-of-chaos

-- 
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/CAGBeqiMW1r%2B4%2Bu9gcLLvRFF8rd90QqEC0jdooL7jUCtp_unaPg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


RE: big legacy database with complex many to many relationships

2014-02-24 Thread Sells, Fred
Thanks,  I think you set me on the right track.

Fred.

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Javier Guerra Giraldez
Sent: Monday, February 24, 2014 3:12 PM
To: django-users@googlegroups.com
Subject: Re: big legacy database with complex many to many relationships

On Mon, Feb 24, 2014 at 2:54 PM, Sells, Fred  
wrote:
> I have to integrate to a large read only legacy mssql database .


while certainly it's possible to configure this as a second database and use 
the ORM, I've found that it's more work than usually needed.
especially if you already have defined SQL patterns, or worse, stored 
procedures.  porting those to ORM means debugging them again...

but there's nothing preventing you from using any Python way to access that 
data.  particularly if you're going to treat it as read-only.
just write some utility functions that use ODBC or any other interface to pull 
your data and use that in your Django views, or even in your models.

--
Javier

--
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/CAFkDaoS1WBGDN80v5J%2BCh%2BXCx_g1SD2obvjG51AqO_YJA0mM7w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

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


Re: Django substitute old image of ImageFile

2014-02-24 Thread Mike Dewhirst

Fabrizio

Very nice - I'll borrow that for sure :)

Thanks

Mike

On 24/02/2014 11:38pm, Fabrizio Alongi wrote:

Hi, after I've searched online, and from this reply
I
have wrote this solution by overriding save method of my model class.

def save(self, force_insert=False, force_update=False, using=None,
update_fields=None):
 # if an element exist
 if self.id is not None:
 current = MyModelClass.objects.get(id=self.id)
 if self.image != current.image:
 # Delete old image and thumbnail
 current.image.delete(save=False)# Set save=False
because it's saving now.
 super(MyModelClass, self).save(force_insert, force_update,
using, update_fields).

Simple!

--
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/d9112e90-fd44-41bc-8710-e0c936082f3c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/530BC50C.3000806%40dewhirst.com.au.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django test client encoding of JSON Booleans

2014-02-24 Thread Tom Evans
On Mon, Feb 24, 2014 at 7:37 PM, Daniel Smith
 wrote:
> Thank you very much for the help. So it sounds like I just have to suck it
> up and call json.loads() on request.body.
>
> The 'format=json' thing is related to also using the TastyPie test client.
> I've tried both and forgot where that parameter was used.
>
> Thanks,
> Daniel

Possibly - but the thing you DO have to do is give JSON data *TO* the
test client, instead of a python dictionary which will get converted
to a string (which, by chance, is JSON decodable).

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1KYmtN2z7t56eK2k35yc8r9%3DjesxuKp6KyTAoT4oh8iWw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: big legacy database with complex many to many relationships

2014-02-24 Thread Tom Evans
On Mon, Feb 24, 2014 at 7:54 PM, Sells, Fred
 wrote:
> I have to integrate to a large read only legacy mssql database .
>
>
>
> The many-to-many tables have a lot of additional fields like start/end dates
> of the relationship and their own naming conventions
>
>
>
> Can anyone point me to some links that treat this topic in depth.  I’ve
> looked at the django book and that’s a starting point,
>
>
>
> Can anyone point me to some good “how to” links on this that provide some
> details and some pitfalls to watch for.
>

At $JOB we have very successfully integrated django into our existing
(homebrew) C++ ORM and web framework - we do new development in
django, and gradually the C++ code diminishes (only 390k LOC to go!).
Our objects are beyond complex, a typical item has some 100+ M2M
relationships, often with extra data in the join table. Django can
handle this mostly fine, I suppose the one caveat is that our
pre-existing system modelled very closely the database structure that
django would have used.

So if your data is nicely BCNF already, you shouldn't have many
problems. The Django docs has a section on integrating with legacy
databases, don't bother looking at it, it suggests to use inspectdb..

Instead, model your objects and then write django model classes for
them, one by one, setting the appropriate field and meta options so
that it finds the right tables and columns for that model. Lather,
rinse, repeat until all your models are done.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1LUjCXphTOXs7MGbKZw%2BxDAi0aT-vpOgBaJsj11-RtXtA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: source code of the Django Tutorial?

2014-02-24 Thread fousto
Yes so I just went to 1.7 and started over.  But the big problem they only 
give you code excerpts and newbies like me in the source code file.  Bummer 
because I get indentation 
errors all the time


On Monday, October 21, 2013 12:47:51 PM UTC-7, Yang Yang wrote:
>
> the tutorial is extremely helpful: 
> https://docs.djangoproject.com/en/dev/intro/tutorial01/
>
> but the code samples there seems to be somehow out of sync with the text, 
> for example  some parts of the code uses the class "Poll" while some parts 
> use "Question".
>
> is there a complete set of source files showing the complete 6 tutorials?
>
> thanks!
> yang
>

-- 
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/5bed2028-5185-4aa8-b493-c9454ca544cf%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django friendly payment gateway ,what about Eway ?

2014-02-24 Thread lu zou
 Can someone please advise some payment gateway which is friendly with 
mezzanine(cartridge) based project ,which is also easy to be implemented 
,since I donot quite know a lot about this ,and the website is supposed to 
be generally used in Australia . I am now considering Eway , is it a good 
Choice?

cheers
Claire ZOU

-- 
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/f9e8cea3-bdfe-4494-a05f-9267e9a04db7%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django friendly payment gateway ,what about Eway ?

2014-02-24 Thread Mario Gudelj
Eway is a great gateway for OZ and quite easy to integrate. Not sure how
well it works with other currencies.
On 25/02/2014 10:21 am, "lu zou"  wrote:

>  Can someone please advise some payment gateway which is friendly with
> mezzanine(cartridge) based project ,which is also easy to be implemented
> ,since I donot quite know a lot about this ,and the website is supposed to
> be generally used in Australia . I am now considering Eway , is it a good
> Choice?
>
> cheers
> Claire ZOU
>
> --
> 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/f9e8cea3-bdfe-4494-a05f-9267e9a04db7%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

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


Re: source code of the Django Tutorial?

2014-02-24 Thread Mike Dewhirst

On 25/02/2014 9:56am, fou...@mac.com wrote:

I get indentation errors all the time


Does your editor use 4 spaces instead of tab chars and does it convert 
all tabs to 4 spaces?


--
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/530BEA14.4020801%40dewhirst.com.au.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to return Random items from a Mongodb Resource

2014-02-24 Thread Camilo Torres
On Monday, February 24, 2014 8:28:23 AM UTC-4:30, Anuj Chauhan wrote:
>
> Hi Friends,
>
> I need to return random items from a tastypie resource which is 
> a resources.MongoEngineResource.
>
> I have already tried using MyClass.objects.all().order_by('?'), but it 
> simply keep returning the same rows always. Following is the code of my 
> resource.
>
Hello,

You should use the Python's built-in random module. See random.sample()

Regards,
Camilo

-- 
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/485cabc9-86f1-4a2e-8e09-0fc744e76c43%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.