Relation in Django REST Framework?

2014-04-08 Thread Shoaib Ijaz


I am using serializers.GeoFeatureModelSerializer to serialize Model. I have 
a queryset

that is creating Left Outer Join. I want to serialize related Model fields

Here is my Model

class LookupTiming(models.Model):
day = models.CharField(max_length=7)
time_1 = models.TimeField()
time_2 = models.TimeField()

class Meta:
db_table = u'lookup_timing'
class Streets(models.Model):
name = models.CharField(max_length=50)
geometry = models.GeometryField(null=True, blank=True)
objects = models.GeoManager()

class Meta:
db_table = u'streets'

def __unicode__(self):
return '%s' % self.name

class StreetTimings(models.Model):
street= models.ForeignKey(Streets)
lookuptiming = models.ForeignKey(LookupTiming)
class Meta:
db_table = u'street_timings'

queryset = Streets.objects.filter(streettimings_*lookuptiming*_isnull=True)

Serializer Class

class StreetSerializer(gis_serializer.GeoFeatureModelSerializer):

class Meta:
model = Streets
geo_field = "geometry"
id_field = False
fields = ('id', 'streettimings__lookuptiming__day', other fields)

I want to show following fields

street_*id, LookupTiming*_day, LookupTiming__time_1 , LookupTiming__time_2

How can i do this?

Thank you

-- 
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/e1b1c3e1-f6c1-4046-9404-67b30a8fdb93%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Saving forms with ManyToMany relationships

2014-04-08 Thread Jason S
Hi,
Thanks very much, I can now save the item.component and item.category many 
to many fields.
However I can't save the user as request.user and it still boils down to 
not quite understanding how to specify a field value to be saved.

I've tried variations of my original code and suggestions online including 
setting the field using cleaned_data, without success.
If you could please let me know how to do that then I should be fine form 
there.

Thanks again,
J

On Tuesday, 8 April 2014 14:40:13 UTC+12, Camilo Torres wrote:
>
> Hello,
>
> This works for me, saving the related objects in the many to many 
> relationship. You can start from there to build yours:
>
> models.py:
>
> class Student(models.Model):
> name = models.TextField()
>
>
> class Course(models.Model):
> name = models.TextField()
> students = models.ManyToManyField(Student, related_name='courses')
>
> forms.py.
>
> class NewItemForm(ModelForm):
> 
> class Meta:
> model = Course
> fields = ('name', 'students')
>
> view.py:
>
> def create_item(request):
> if request.method == 'POST':
> form = NewItemForm(request.POST)
> if form.is_valid():
> form.save()
> return HttpResponse('saved')
> return HttpResponse('Form not valid')
> else:
> form = NewItemForm()
> return render_to_response('testapp/create_item.html', {'form': 
> form}, context_instance=RequestContext(request))
>
>
> create_item.html:
>
> {% csrf_token %}
> {{ form.as_p }}
> 
> 
>
>
>
> Regards,
> Camilo
>
> On Monday, April 7, 2014 7:51:30 PM UTC-4:30, Jason S wrote:
>>
>> Hi Camilo,
>> I really appreciate your response.
>> I had another go at this last night, particularly trying to use the 
>> add(component()) snippet.
>>
>> To respond to your notes:
>> 1. I simplified and used a find-replace to replace the model names which 
>> is likely why it dosn't compile, sorry about that. Mine compiles and i'm 
>> happy to PM you the code if you'd like.
>> 2. I have very limited programming experience at this point and my 
>> project is the cumulation of experimentation, examples and documentation 
>> i've read... I believe your saying I don't need to use the "instance"s?
>> 3. Good point, thank you.
>> 4. I've added the lines which try to ensure the m2m relationships are 
>> added, such as  
>> new_item.category.add(new_item)
>> new_item.components.add(new_item)
>> during my attempts to get the form to save the many to many data.
>>
>> What i'm trying to do is create a basic form which allows a user to fill 
>> in the name, desc, img, category and component fields
>> When they save this form, i'd like the "item" to be saved (which is 
>> happening) as well as the user, category and component data to be 
>> associated to the item.
>> Currently only the user is being associated to the item when I complete 
>> the form and save it.
>>
>> Once I can do that, i'll move on to using widgets to make the category 
>> field a drop down and the component field/s tick boxes and continue adding 
>> form validation etc but i've been stuck on this saving issue for some time.
>>
>> Thanks again for your time and help. 
>>
>>
>>
>> On Monday, 7 April 2014 10:58:21 UTC+12, Camilo Torres wrote:
>>>
>>> On Saturday, April 5, 2014 10:12:36 PM UTC-4:30, Jason S wrote:

 I've seen quite a few examples showing various ways to create a form 
 using manytomany relationships and save the data, but i'm still missing a 
 key piece of the puzzle.
 I've created a form and it "works", meaning the form creates a new Item 
 object and associates the user.
 However i'm not sure how to go about saving the item category and item 
 components selected in the form.

 I've tried quite a few things over the last week and i know its quite 
 easy, but just haven't quite gotten there yet and would appreciate some 
 guidance.

 FORM:
 class NewItemForm(ModelForm):

 class Meta:
 model = Item
 fields = ('name', 'desc', 'img','category','components')

 def save(self, user, component commit = True):
 """Append the component list to the item"""
 new_item = super(NewItemForm, self).save(commit = Fals

 if commit:
 new_item.save()
 #new_item.save_m2m()
 new_item.user.add(user)
 if component != "none":
 new_item.category.add(new_item)
 new_item.components.add(new_item)

 return new_item

 VIEW:
 def create_item(request):

 if request.method == "POST":
 form = NewItemForm(request.POST, instance=item())
 if form.is_valid():
 form.save(request.user, "none")
 return HttpResponseRedirect(reverse('nav.views.dashboard'))
 else:
 form = CategoryForm(instance=i

Django 1.6 and Multiprocessing

2014-04-08 Thread Doug Gargin
I've been upgrading some Django apps from Django 1.5 to 1.6, and am using 
Python 2.7.5.

One of the apps is a stand-alone app that uses the Django ORM to access a 
couple of MySQL databases. When it starts up this app spawns some worker 
tasks via Python's multiprocessing module. These workers also need to 
access the databases. This app worked on Django 1.5, but when dropping in 
Django 1.6 (and changing from using commit_on_success/commit_manually to 
atomic/set_autocommit) I got the following exception:

ProgrammingError: (2014, "Commands out of sync; you can't run this command 
now")

After some investigation it seemed that this may have been because the 
database connection was being shared between all of the processes. As each 
process was dropping in and out of the 'atomic' blocks of code the 
auto-commit state of the connection was being changed (Django 1.6 uses 
database-level auto-commit whereas Django 1.5 used application-level 
auto-commit). It seemed that the processes concurrently changing the 
auto-commit mode in an uncoordinated way was causing the 'ProgrammingError' 
exception. I fixed this by using database aliases in Django's DATABASES 
setting, see this link:

http://stackoverflow.com/questions/22518156/multiple-concurrent-database-transactions-with-django

I made sure that each process only used its own database connection which 
it could change the auto-commit state of without affecting the other 
connections. This got rid of the exception I was seeing.

My question relates to a second app which uses nginx/gunicorn to also 
access databases through the Django ORM. This set-up could have multiple 
simultaneous users, so database accesses could overlap simultaneously in a 
similar way (although the affect of this is more difficult to test at the 
moment). The question is, could these concurrent accesses interfere in the 
same way as in the stand-alone app? I'm assuming that things will be fine, 
but the nginx/gunicorn model would seem to share similarities with the 
stand-alone app that uses Python multi-processing; it sounds like the 
gunicorn processes could share the same database connection. So the 
questions are:

1. Will the nginx/guicorn app be ok in terms of concurrent database 
accesses for Django 1.6? (I suspect the answer to this is yes, since the 
Django/nginx/gunicorn combination is, I believe, quite common)
2. If the answer to 1 is yes, why have I had to use database aliases to 
solve the problem in the stand-alone app? Is there a better way to do it, 
perhaps a Django setting I could use somewhere?
3. Why was this not an issue for Django 1.5? I have read that Django 1.5 
tended to make separate connections to the database, but I haven't gone as 
far as observing how and when it might do this in our apps.

Thanks to anyone that comments on this thread.

-- 
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/349125a7-17ab-4e01-8856-4204829b6083%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Inlines in admin

2014-04-08 Thread Emanuel
It solves the problem.

Thanks


Segunda-feira, 7 de Abril de 2014 22:52:15 UTC+1, Marc Aymerich escreveu:
>
> On Mon, Apr 7, 2014 at 3:04 PM, Emanuel > 
> wrote: 
> > Hi all! 
> > 
> > I'm have the following models: 
> > 
> > Class A(models.Model): 
> >  pass 
> > 
> > 
> > Class Z(models.Model): 
> > pass 
> > 
> > 
> > Class B(models.Model): 
> >   a = models.ForeignKey(a) 
> >   z = models.ForeignKey(Z) 
> > 
> >def __unicode__(self): 
> >   return self.z 
> > 
> > 
> > Class C(models.Model): 
> >  b = models.ForeignKey(B) 
> > 
> > 
> > I Want in the admin add A,B and C objects. 
> > 
> > I know how to put inline objects of B in A. Everything works as 
> expected. 
> > But I want to create new C's in the same page. Something like having C 
> as an 
> > Inline of B, beeing B an Inline of A. It could appear all in popups... 
>
> nested inlines are not currently supported. A work around can be using 
> a readonly field on B inline that points to a B change view with C 
> inlines 
>
>
> class BInline(admin.TabularInline): 
> model = B 
> readonly_fields = ('c_link',) 
>
> def c_link(self, instance): 
>   if not instance.pk: 
> return '' 
>   url = reverse('admin:app_c_change', args=(instance.pk,)) 
>   popup = 'onclick="return showAddAnotherPopup(this);"' 
>   return '%s' % (url, popup, instance) 
>  c_link.allow_tags=True 
>
>
> class CInline(admin.TabularInline): 
>  model = C 
>
>
> class AModelAdmin(admin.ModelAdmin): 
>  inlines = [BInline] 
>
>
> class BModelAdmin(admin.ModelAdmin): 
> inlines = [Cinline] 
>

-- 
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/aec1a1f9-33af-4e31-b2f2-99a548e8b84f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


1054 Unknown column content_type_id in field list django 1.7b1

2014-04-08 Thread maxwell
Hi.

I'm using django 1.7b1. And I made generic relation in my models:

class Transaction(models.Model):
...

# Generic foreign key
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey('content_type', 'object_id')



class Document(models.Model): 

... 

transactions = GenericRelation(Transaction)

and admin.py:

 class TransactionInline(GenericTabularInline):
model = Transaction
formfield_overrides = {
models.TextField: {'widget': forms.Textarea(attrs={'cols': 40,
   'rows': 2})}
}


@admin.register(Document)
class DocumentAdmin(admin.ModelAdmin):
   ...
inlines = [
TransactionInline,
] 



Can you suggest where the problem may be? I have some similar fields in my 
old project (django 1.6) and all works fine.
 

-- 
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/9f35b8c1-795c-4296-8b00-aaea02a3f516%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 1054 Unknown column content_type_id in field list django 1.7b1

2014-04-08 Thread maxwell
The error occurs on record save in django admin. 

-- 
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/02a4dedc-b44f-46af-88ba-4230b08800b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Dynamic Formsets

2014-04-08 Thread Alejandro Perez
Hey Leandro, I'm looking for something like that and your topic question is 
rolling in my head.. Could you please share your solution with the 
community? :D
Thanks !!! :)

El lunes, 7 de abril de 2014 15:53:13 UTC-4, Leandro Alves escribió:
>
> Done. :)
>
> Thanks!!!
>
>
> On Monday, April 7, 2014 9:42:53 PM UTC+2, Gladson Simplício Brito wrote:
>>
>> Okay, send email here:
>>
>> gla...@immensa.com.br
>>
>>
>> 2014-04-07 15:24 GMT-04:00 Leandro Alves :
>>
>>> Brother, I think I have tried all of those already and some other around 
>>> the internet... 
>>> I couldn't find anyone that works with Django 1.6. 
>>>
>>> I will send you an email with what I need, ok? :)
>>>
>>> Thanks again!
>>>
>>> Leandro
>>>
>>>
>>>
>>> On Monday, April 7, 2014 8:43:06 PM UTC+2, Gladson Simplício Brito wrote:
>>>
 Try these:
 https://pypi.python.org/pypi?%3Aaction=search&term=formset&;
 submit=search

 If not, tell your need.
 :D


 2014-04-07 14:16 GMT-04:00 Leandro Alves :

> Yes.. I have tried that one as well.. but the example still doesn't 
> work... =/
>
> Any freelance available for this? 
>
> Thanks for the feedback!
>
> Leandro
>
>
> On Mon, Apr 7, 2014 at 7:33 PM, Gladson Simplício Brito <
> gladso...@gmail.com> wrote:
>
>> The project was migrated to another repository:
>>
>> https://github.com/elo80ka/django-dynamic-formset
>>  
>>
>> 2014-04-07 13:13 GMT-04:00 Leandro Alves :
>>
>>>  Hi, 
>>>
>>> I wonder if anyone knows of any example of django-dynamic-formsets 
>>> [1] that works with Django 1.6?
>>>
>>> So far all I found on the internet are over 3 years old and they 
>>> don't work with Django version 1.6. 
>>>
>>> I am willing to pay for any example that works if necessary. :)
>>>
>>> Thanks in advance, 
>>>
>>> Leandro
>>>
>>>
>>> [1] - https://code.google.com/p/django-dynamic-formset/
>>>  
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, 
>>> send an email to django-users...@googlegroups.com.
>>>
>>> To post to this group, send email to django...@googlegroups.com.
>>>
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/95dc89cb-
>>> cdd7-43c5-adca-da0a1aaf9573%40googlegroups.com
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  -- 
>> You received this message because you are subscribed to a topic in 
>> the Google Groups "Django users" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/
>> topic/django-users/_sfhHrcDJBs/unsubscribe.
>>  To unsubscribe from this group and all its topics, send an email to 
>> django-users...@googlegroups.com.
>> To post to this group, send email to django...@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/CAKN-GttJ2YrMgc7gRNdhm7H0jg3yanH_
>> rYV9Z%3Df2SwLJ3L%2BX1Q%40mail.gmail.com
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  -- 
> You received this message because you are subscribed to the Google 
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
>
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAA-sWORBDh6Bi_Ts9LL4ygAMksCQShNQoQSpS%
> 3DuQKiXTxafvkw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

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

Re: Django Dynamic Formsets

2014-04-08 Thread Leandro Alves
Hello Alejandro!!!

Man...I swear, if I had it I would be sooo happy to share... :)

I still couldn't get a normal Formset example to work.. Do you have any 
simple foo example to share? hehehe
I'm trying 
from https://docs.djangoproject.com/en/1.6/topics/forms/formsets/.

I also tried to make the "demo" example from django-dynamic-formsets works 
with Django 1.6. But not luck...

But I keep trying and I will post here If I got any news. :)

Best regards, 

Leandro



On Tuesday, April 8, 2014 3:32:44 PM UTC+2, Alejandro Perez wrote:
>
> Hey Leandro, I'm looking for something like that and your topic question 
> is rolling in my head.. Could you please share your solution with the 
> community? :D
> Thanks !!! :)
>
> El lunes, 7 de abril de 2014 15:53:13 UTC-4, Leandro Alves escribió:
>>
>> Done. :)
>>
>> Thanks!!!
>>
>>
>> On Monday, April 7, 2014 9:42:53 PM UTC+2, Gladson Simplício Brito wrote:
>>>
>>> Okay, send email here:
>>>
>>> gla...@immensa.com.br
>>>
>>>
>>> 2014-04-07 15:24 GMT-04:00 Leandro Alves :
>>>
 Brother, I think I have tried all of those already and some other 
 around the internet... 
 I couldn't find anyone that works with Django 1.6. 

 I will send you an email with what I need, ok? :)

 Thanks again!

 Leandro



 On Monday, April 7, 2014 8:43:06 PM UTC+2, Gladson Simplício Brito 
 wrote:

> Try these:
> https://pypi.python.org/pypi?%3Aaction=search&term=formset&;
> submit=search
>
> If not, tell your need.
> :D
>
>
> 2014-04-07 14:16 GMT-04:00 Leandro Alves :
>
>> Yes.. I have tried that one as well.. but the example still doesn't 
>> work... =/
>>
>> Any freelance available for this? 
>>
>> Thanks for the feedback!
>>
>> Leandro
>>
>>
>> On Mon, Apr 7, 2014 at 7:33 PM, Gladson Simplício Brito <
>> gladso...@gmail.com> wrote:
>>
>>> The project was migrated to another repository:
>>>
>>> https://github.com/elo80ka/django-dynamic-formset
>>>  
>>>
>>> 2014-04-07 13:13 GMT-04:00 Leandro Alves :
>>>
  Hi, 

 I wonder if anyone knows of any example of django-dynamic-formsets 
 [1] that works with Django 1.6?

 So far all I found on the internet are over 3 years old and they 
 don't work with Django version 1.6. 

 I am willing to pay for any example that works if necessary. :)

 Thanks in advance, 

 Leandro


 [1] - https://code.google.com/p/django-dynamic-formset/
  
 -- 
 You received this message because you are subscribed to the Google 
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, 
 send an email to django-users...@googlegroups.com.

 To post to this group, send email to django...@googlegroups.com.

 Visit this group at http://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/95dc89cb-
 cdd7-43c5-adca-da0a1aaf9573%40googlegroups.com
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>  -- 
>>> You received this message because you are subscribed to a topic in 
>>> the Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/
>>> topic/django-users/_sfhHrcDJBs/unsubscribe.
>>>  To unsubscribe from this group and all its topics, send an email to 
>>> django-users...@googlegroups.com.
>>> To post to this group, send email to django...@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/CAKN-
>>> GttJ2YrMgc7gRNdhm7H0jg3yanH_rYV9Z%3Df2SwLJ3L%2BX1Q%40mail.gmail.com
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  -- 
>> You received this message because you are subscribed to the Google 
>> Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, 
>> send an email to django-users...@googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com.
>>
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/CAA-sWORBDh6Bi_Ts9LL4y

Re: Django Dynamic Formsets

2014-04-08 Thread Leandro Alves
Hello Venkatraman,

Yes.. I saw this one was well... and I want to try it.. but I'm still 
learning about Formsets...
Would you have any basic simple foo example to share? :)

Best, 

Leandro



On Tuesday, April 8, 2014 2:48:15 AM UTC+2, Venkatraman.S. wrote:
>
> Have you tried the jquery formset - works like a breeze for me. 
>
>
> On Mon, Apr 7, 2014 at 10:43 PM, Leandro Alves 
> > wrote:
>
>> Hi, 
>>
>> I wonder if anyone knows of any example of django-dynamic-formsets [1] 
>> that works with Django 1.6?
>>
>> So far all I found on the internet are over 3 years old and they don't 
>> work with Django version 1.6. 
>>
>> I am willing to pay for any example that works if necessary. :)
>>
>> Thanks in advance, 
>>
>> Leandro
>>
>>
>> [1] - https://code.google.com/p/django-dynamic-formset/
>>  
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/95dc89cb-cdd7-43c5-adca-da0a1aaf9573%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/5784f512-3a99-419e-8e06-1bfe5ef1ba55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django admin for public pages

2014-04-08 Thread Andrew Pashkin
I'm thinking about using django.contrib.admin for public facing pages.
On the one hand, seems like it is not recommended:

It’s not intended to be a *public* interface to data, nor is it intended to 
> allow for sophisticated sorting and searching of your data. As we said 
> early in this chapter, it’s for trusted site administrators. Keeping this 
> sweet spot in mind is the key to effective admin-site usage.

http://www.djangobook.com/en/2.0/chapter06.html 

On the other hand, there is a 
people, 
who use it that way, and I dont see any restrictions for it.

Does anybody have experience with subj? 
Or is there some possible pitfalls?

-- 
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/cf86bb94-8cb7-43fc-92c6-2cb98ab46842%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django admin for public pages

2014-04-08 Thread Jorge Andrés Vergara Ebratt
Depending on the project, I've done projects entirely made of the admin
On Apr 8, 2014 11:53 AM, "Andrew Pashkin"  wrote:

> I'm thinking about using django.contrib.admin for public facing pages.
> On the one hand, seems like it is not recommended:
>
> It's not intended to be a *public* interface to data, nor is it intended
>> to allow for sophisticated sorting and searching of your data. As we said
>> early in this chapter, it's for trusted site administrators. Keeping this
>> sweet spot in mind is the key to effective admin-site usage.
>
> http://www.djangobook.com/en/2.0/chapter06.html
>
> On the other hand, there is a 
> people,
> who use it that way, and I dont see any restrictions for it.
>
> Does anybody have experience with subj?
> Or is there some possible pitfalls?
>
> --
> 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/cf86bb94-8cb7-43fc-92c6-2cb98ab46842%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


recommended fcgi way for django 1.6 on windows? Problems with https

2014-04-08 Thread anton
Hi ,

I use:
 - windows 7 64 bit
 - python 2.7.6 (32bit)
 - apache 2.4.9 (32bit vc9 build from apachelounge) 
 - django 1.6.2
 - flup for fcgi ( noted as prerequisite in django docs)

I use flup for running django as fcgi,
unfortunately I have the problem that
my django app runs fine with http but not with https.

I saw that in https mode the request.path
variable in my view is not '/mydjangoapp/' (like in http mode)
but '/mydjangoapp/mydiangoapp/'.

So the links which are calculated with the reverse("myapp.myview") function
are wrong.

I looked a bit in flup bit did not fully understan why it builds the
request.path variable the way it does (add least in https mode 
the apache does not create a SCRIPT_URL = the env["SCRIPT_URL"] in flup
is empty, and this seems to cause the problem).

my questions are now:
 - Is there any special point to take care about when using https?
 - is there another reccomended way to do fcgi (on windows)??

I ask this because flup seems *dead*, and the flup website 
is down since *months* now (at least it was down every time I tried to
access the flup trac).

So what is the future for django and fcgi on windows,
or will this functionality be integrated in django 1.7 (would be nice).

Thanks

  anton


-- 
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/li1ah2%24245%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.


Re: Error with GeoDjango serializer and ForeignKey field

2014-04-08 Thread Jorge Arevalo
On Sunday, April 6, 2014 11:13:30 PM UTC+2, Jorge Arevalo wrote:
>
> (Sorry for the cross posting. I'm not sure about the best place to put my 
> question. So, I put it in StackOverflow too. And I know that a post that 
> contains just a link to another page can be considered spam. So, I C&P the 
> content here)
>
> I have a problem with *Django 1.5.4*. I put the question in StackOverflow 
> instead ofhttp://gis.stackexchange.com/ because I'm almost 100% sure is 
> not a GIS related problem.
>
> Here is my set up:
>
> My *models.py*
>
> from django.contrib.auth.models import Userfrom django.contrib.gis.db import 
> models as gismodels
> # This models a region of interest, using a polygonclass ROI(gismodels.Model):
> label = models.CharField(max_length=256, default='ROI')
> area = models.FloatField(default=0.0)
> geom = gismodels.PolygonField(srid=4326)
> when = models.DateTimeField(default=datetime.now())
> user = models.ForeignKey(User, null=True)
>
> objects = gismodels.GeoManager()
>
> def __unicode__(self):
> return unicode(self.label)
>
> class Meta:
> ordering = ['when']
>
> class Indicator(models.Model):
> name = models.TextField()
> color = models.TextField()
> measurement_units = models.CharField(max_length=100)
> algorithm = models.CharField(max_length=256)
> data_origin = models.TextField()
>
> class Series(models.Model):
> roi = models.ForeignKey(ROI)
> indicator = models.ForeignKey(Indicator)
>
> As you can see, *Series model contains a reference to ROI model*
>
> My *settings.py*
>
> SERIALIZATION_MODULES = {
> 'geojson': 'djgeojson.serializers'}
>
> I'm using django-geojson 
>  to *serialize my ROI objects into GeoJSON*. I want to use this 
> serializer to send a GeoJSON to my clients. So, my views.py looks like this
>
> My *views.py*
>
> @login_requireddef get_rois(request):
> rois_query = ROI.objects.filter(user=request.user)
>
> polygons = json.loads(serializers.serialize('geojson', rois_query))
>
> return HttpResponse(json.dumps(polygons), mimetype='application/json')
>
> The problem: *I'm getting this error in serialize call*
>
> AttributeError: 'ROI' object has no attribute 'roi'
>
> The *relevant part of the error stack* is this
>
> File 
> "/home/vagrant/.virtualenvs/myapp/local/lib/python2.7/site-packages/django/core/serializers/__init__.py",
>  line 122, in serialize
> s.serialize(queryset, **options)
>   File 
> "/home/vagrant/.virtualenvs/myapp/local/lib/python2.7/site-packages/djgeojson/serializers.py",
>  line 349, in serialize
> self.serialize_queryset(queryset)
>   File 
> "/home/vagrant/.virtualenvs/myapp/local/lib/python2.7/site-packages/djgeojson/serializers.py",
>  line 321, in serialize_queryset
> self.handle_reverse_field(obj, field, field_name)
>   File 
> "/home/vagrant/.virtualenvs/myapp/local/lib/python2.7/site-packages/djgeojson/serializers.py",
>  line 243, in handle_reverse_field
> values = [reverse_value(related) for related in getattr(obj, 
> field_name).iterator()]
>
> Looking at the stack, looks like there's a problem resolving the *reverse 
> reference* of ROI to Series. Series has a roi field pointing to ROI, and 
> I think the serializer thinks the roi field belongs to ROI class 
> (incorrect) instead of to Series (correct). The expression *infinite loop* 
> comes 
> to my mind.
>
> Besides, *if I delete the roi field from Series model class, it works*
>
> I'm not sure about if it's a bug of django-geojson plugin (using the last 
> version) or something wrong with my code (most likely). I've tried with the 
> default json serializer, and still getting the same error. And also tried 
> to inherit all model classes from gismodels instead of models. No effect.
>
> Any clues?
>

Ok, I managed to solve it. Looks like there is a bug in the django-geojson 
plugin . It can't 
handle the backward relations. So, I just told Django to *avoid the 
backward relation creation* between ROI and 
Series

class Series(gismodels.Model):
# Prevents django to create a backwards relation between ROI and Series
roi = models.ForeignKey(ROI, related_name='+')
indicator = models.ForeignKey(Indicator)


 

-- 
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/482c97aa-3827-4efa-80b9-9fa1359821d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: recommended fcgi way for django 1.6 on windows? Problems with https

2014-04-08 Thread Russell Keith-Magee
On Wed, Apr 9, 2014 at 1:09 AM, anton  wrote:

> Hi ,
>
> I use:
>  - windows 7 64 bit
>  - python 2.7.6 (32bit)
>  - apache 2.4.9 (32bit vc9 build from apachelounge)
>  - django 1.6.2
>  - flup for fcgi ( noted as prerequisite in django docs)
>
> I use flup for running django as fcgi,
> unfortunately I have the problem that
> my django app runs fine with http but not with https.
>
> I saw that in https mode the request.path
> variable in my view is not '/mydjangoapp/' (like in http mode)
> but '/mydjangoapp/mydiangoapp/'.
>
> So the links which are calculated with the reverse("myapp.myview") function
> are wrong.
>
> I looked a bit in flup bit did not fully understan why it builds the
> request.path variable the way it does (add least in https mode
> the apache does not create a SCRIPT_URL = the env["SCRIPT_URL"] in flup
> is empty, and this seems to cause the problem).
>
> my questions are now:
>  - Is there any special point to take care about when using https?
>  - is there another reccomended way to do fcgi (on windows)??
>
> I ask this because flup seems *dead*, and the flup website
> is down since *months* now (at least it was down every time I tried to
> access the flup trac).
>
> So what is the future for django and fcgi on windows,
> or will this functionality be integrated in django 1.7 (would be nice).
>

There *is* no future for FCGI on Django, on Windows or any other operating
system. We've deprecated support for FCGI, and will be removing support for
FCGI in the Django 1.9 release.

Third party projects may choose to maintain support for FCGI wrappers to
Django, but that will be outside the official project.

If you want to deploy a Django site, you should be using WSGI. A wide range
of servers and service providers support WSGI; However. I can't comment on
which ones are especially good or bad under Windows.

Yours,
Russ Magee %-)

-- 
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/CAJxq849xbjrohAQZavkXZ_8HrQDNiPJg-24w_ep5VD6gMu5Q1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Mock Django FileSystemStorage location?

2014-04-08 Thread galgal


I try to mock FileUpload in django view (admin view).

My model looks like that:

class BaseImage(models.Model):
# create path for uploaded images
_storage_path = os.path.abspath(os.path.join(
os.path.dirname(__file__),
'secure_media'))
_image_storage = FileSystemStorage(location=_storage_path)

image = SorlImageField(
verbose_name=_(u'image'),
storage=_image_storage,
upload_to="%Y/%m")

class Meta:
abstract = True

and test:

def test_add_new_as_main(self):
url = reverse('admin:galleries_secureimage_add')

post_data = {
'image': get_temporary_image()
}
response = self.client.post(url, post_data)

This uploads file to directory specified in _storage_path and I want to 
change that in my test.

How can I mock _storage_path to return different path in my tests? I tried 
to use Mock() library but can't make that work.

Can you 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/8bcd2578-b9a9-4662-97ff-7867c88f2829%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: GeometryField.geography = True Syntax Help GIS Model

2014-04-08 Thread si . at . sh
Hope you got to the bottom of this, and yes I thought your original 
question was pretty direct.

If you haven't worked it out already and are still trying to get this 
working (or if anyone else stumbles across this), then essentially yes you 
would pass in geography=True, just as you would specify max_length=30 or 
any other field property.  The documentation suggests this only works with 
SRID 4326, so you need srid=4326 on your field as well.

On Saturday, November 3, 2012 6:24:32 PM UTC, JJ Zolper wrote:
>
> Thanks for the reply.
>
> I actually already have PostgreSQL.
>
> So my question was pretty direct, or so I thought.
>
> I'll try and spell this out again. So if I want to create a column in my 
> database with type "geography" is this the syntax:
>
> mpoly = models.MultiPolygonField(geography=true)
>
> I cannot find an single example where we specify that we want the 
> geography type to be used instead of using geometries.
>
> All I need to know is if that is right? Is it a capitalized "true" so 
> "TRUE" ?
>
> Thanks so much,
>
> JJ
>
> On Friday, November 2, 2012 10:15:40 PM UTC-4, Dump wrote:
>>
>> First of all, you have to create a geo database. Postgis (a PostgreSQL 
>> extension) is the best choice. 
>>
>> After that, you have to define some geography fields and import your 
>> data, shape files (shp), etc. 
>>
>> GeoDjango Tutorial provides all the steps to get it done. 
>>
>> https://docs.djangoproject.com/en/dev/ref/contrib/gis/tutorial/
>>
>> If you are not familiar with geo concepts, I recommend to take a look at 
>> http://geodjango.org/presentations/
>>
>> Hope that helps you
>>
>>
>>
>>
>> On Fri, Nov 2, 2012 at 11:30 PM, JJ Zolper  wrote:
>>
>>> Wait so does anyone know how to do this?
>>>
>>> I posted this a long time ago.
>>>
>>> How do I define a geography field? I need a geography column so I can 
>>> perform geographic queries on it and the documentation doesn't give me 
>>> a definitive way on how to do it.
>>>
>>> Would it be like:
>>>
>>> city = models.CharField(max_length=50, GeometryField.geography = true)
>>>
>>> ???
>>>
>>>
>>> On Saturday, October 20, 2012 1:22:32 PM UTC-4, JJ Zolper wrote:

 Hello everyone,

 So I've decided for my GeoDjango application I want WGS84 along with a 
 geography database column, rather than geometry.

 I was reading here:

 https://docs.djangoproject.com/en/1.4/ref/contrib/gis/
 model-api/#geography

 GeometryField.geography
  

 If set to True, this option will create a database column of type 
 geography, rather than geometry. Please refer to the geography 
 type
  section 
 below for more details.


 that to set up a new column as geography I had to 
 set GeometryField.geography = True.

 I am unsure of the syntax of how to do this? There was no example 
 given. Or where to properly place this line?

 Here is the model.py file I am working on. If you could tell me where 
 to fit this in that would be great?


 from django.contrib.gis.db import models

 class Artist(models.Model):
 name = models.CharField(max_length=30)
 genre = models.CharField(max_length=30)
 city = models.CharField(max_length=60)
 state = models.CharField(max_length=30)
 country = models.CharField(max_length=50)
 website = models.URLField()
 objects = models.GeoManager()

 def __unicode__(self):
return self.name



 Thanks so much,

 JJ

>>>  -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msg/django-users/-/tWBJBDuXZzYJ.
>>> To post to this group, send email to django...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> django-users...@googlegroups.com.
>>> For more options, visit this group at 
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>
>>
>> -- 
>> Christiano Anderson | http://christiano.me/
>> http://twitter.com/dump
>>  
>

-- 
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/a4d6ef0c-b33d-4fc9-8e25-47f5b7dad004%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Dynamic Formsets

2014-04-08 Thread Venkatraman S
Actually, there is nothing more to it. Include the js and create the
formset_factory and start using it in the template by iterating over it. In
the view, post-POST, again iterate over the formsets. Bulk of the work is
done by the js and you dont have to do much in django. There is a minor bug
in the js which lets even one row in the UI to get deleted, but its not a
show-stopper :)

Let me know if its still trouble and I shall write something up.

On Tue, Apr 8, 2014 at 10:16 PM, Leandro Alves  wrote:

> Hello Venkatraman,
>
> Yes.. I saw this one was well... and I want to try it.. but I'm still
> learning about Formsets...
> Would you have any basic simple foo example to share? :)
>
> Best,
>
> Leandro
>
>
>
> On Tuesday, April 8, 2014 2:48:15 AM UTC+2, Venkatraman.S. wrote:
>
>> Have you tried the jquery formset - works like a breeze for me.
>>
>>
>> On Mon, Apr 7, 2014 at 10:43 PM, Leandro Alves  wrote:
>>
>>> Hi,
>>>
>>> I wonder if anyone knows of any example of django-dynamic-formsets [1]
>>> that works with Django 1.6?
>>>
>>> So far all I found on the internet are over 3 years old and they don't
>>> work with Django version 1.6.
>>>
>>> I am willing to pay for any example that works if necessary. :)
>>>
>>> Thanks in advance,
>>>
>>> Leandro
>>>
>>>
>>> [1] - https://code.google.com/p/django-dynamic-formset/
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>>
>>> Visit this group at http://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/95dc89cb-cdd7-43c5-adca-da0a1aaf9573%
>>> 40googlegroups.com
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> 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/5784f512-3a99-419e-8e06-1bfe5ef1ba55%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Queryset Filters

2014-04-08 Thread Jill Green
I apologize if this question has already been asked and answered.  I want to 
know if it's possible to filter out query sets without doing lazy queries or 
hitting the database again.  Basically I have this query:

qs= self.filter(a months worth of data)

Now if I evaluate this query by doing this:

if qs:
   qs=qs.filter(a weeks worth of data inside that month)

Why does the second filter not just search the objects inside that first 
queryset?  And is there a way to do just that?  Essentially I'm trying to avoid 
hitting the database again.  
I'm using Django 1.3.4 with MySQL if that matters.

Thanks in advance for any replies.

JG

Sent from my iPhone

-- 
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/7A35EE54-5061-4F7B-9664-64D425424D5D%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Queryset Filters

2014-04-08 Thread Anssi Kääriäinen
No, there is no way to do what you want. All filters are implemented as 
filters in the DB, Django doesn't know how to execute them in Python. There 
was some effort to implement filters also in Python, but there hasn't been 
any activity on this recently.

The only way to do this currently is to implement the filtering logic in 
Python yourself.

 - Anssi

On Wednesday, April 9, 2014 8:33:16 AM UTC+3, Jill Green wrote:
>
> I apologize if this question has already been asked and answered.  I want 
> to know if it's possible to filter out query sets without doing lazy 
> queries or hitting the database again.  Basically I have this query: 
>
> qs= self.filter(a months worth of data) 
>
> Now if I evaluate this query by doing this: 
>
> if qs: 
>qs=qs.filter(a weeks worth of data inside that month) 
>
> Why does the second filter not just search the objects inside that first 
> queryset?  And is there a way to do just that?  Essentially I'm trying to 
> avoid hitting the database again.   
> I'm using Django 1.3.4 with MySQL if that matters. 
>
> Thanks in advance for any replies. 
>
> JG 
>
> Sent from my iPhone

-- 
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/d6836bf3-39f4-41bf-a5c5-bd6ffb63ca52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Queryset Filters

2014-04-08 Thread Jill Green
Thank you for the response.  I feared the answered would be no but I wanted to 
be sure.

Sent from my iPhone

On Apr 9, 2014, at 12:27 AM, Anssi Kääriäinen  wrote:

> No, there is no way to do what you want. All filters are implemented as 
> filters in the DB, Django doesn't know how to execute them in Python. There 
> was some effort to implement filters also in Python, but there hasn't been 
> any activity on this recently.
> 
> The only way to do this currently is to implement the filtering logic in 
> Python yourself.
> 
>  - Anssi
> 
> On Wednesday, April 9, 2014 8:33:16 AM UTC+3, Jill Green wrote:
>> 
>> I apologize if this question has already been asked and answered.  I want to 
>> know if it's possible to filter out query sets without doing lazy queries or 
>> hitting the database again.  Basically I have this query: 
>> 
>> qs= self.filter(a months worth of data) 
>> 
>> Now if I evaluate this query by doing this: 
>> 
>> if qs: 
>>qs=qs.filter(a weeks worth of data inside that month) 
>> 
>> Why does the second filter not just search the objects inside that first 
>> queryset?  And is there a way to do just that?  Essentially I'm trying to 
>> avoid hitting the database again.   
>> I'm using Django 1.3.4 with MySQL if that matters. 
>> 
>> Thanks in advance for any replies. 
>> 
>> JG 
>> 
>> Sent from my iPhone
> 
> -- 
> 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/d6836bf3-39f4-41bf-a5c5-bd6ffb63ca52%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/E68D3729-54FA-4A1F-B7FC-4E799597D45B%40gmail.com.
For more options, visit https://groups.google.com/d/optout.