Re: count

2016-01-28 Thread sum abiut
Thanks heaps works perfectly well.

Cheers

On Fri, Jan 29, 2016 at 4:09 PM,  wrote:

> from django.http import HttpResponse
> from django.template import loader, RequestContext
>
> def foreginexchange_view(request):
> t = loader.get_template("template.html")
> test=ball.objects.filter(request="checked").count()
> c = RequestContext(request, {'test': test})
> return HttpResponse(t.render(c))
>
>
> On Wednesday, January 27, 2016 at 11:12:19 PM UTC+2, suabiut wrote:
>>
>> Version 1.7
>>
>> On Wed, Jan 27, 2016 at 10:42 PM,  wrote:
>>
>>> Which version of Django do you using?
>>>
>>> вторник, 26 января 2016 г., 23:14:03 UTC+2 пользователь suabiut написал:

 When i did that i got the error:

 'dict' object has no attribute 'render_context'



 On Tue, Jan 26, 2016 at 7:25 PM,  wrote:

> Try this
> def foreginexchange_view(request):
> t = loader.get_template("template.html")
> test=ball.objects.filter(request="checked").count()
> return HttpResponse(t.render({'test': test}))
>
> On Tuesday, January 26, 2016 at 4:45:52 AM UTC+2, suabiut wrote:
>>
>> Thanks James,
>> here is my view.py
>>
>> def foreginexchange_view(request):
>> test=ball.objects.filter(request="checked").count()
>> return render(request,'template.html',locals())
>>
>>
>>
>> Cheers
>>
>>
>>
>>
>> On Tue, Jan 26, 2016 at 1:30 PM, James Schneider > > wrote:
>>
>>>
>>> On Jan 25, 2016 6:07 PM, "sum abiut"  wrote:
>>> >
>>> > Hi,
>>> > i am trying to count the number of fields that has request field
>>> begin checked and then display the value of count in a template.html 
>>> but i
>>> am not sure how to go about doing that.
>>> >
>>> > For example i want to do something like
>>> >
>>> > test=ball.object.filter(request="checked").count()
>>> >
>>> > then on a template.html i want to out put the value of test
>>> >
>>> > {{test}}
>>> >
>>> > i have try that but i am not getting any value from the output.
>>> >
>>>
>>> Can you post your view? You would run that query in your view and
>>> then pass it to your template through the context.
>>>
>>> -James
>>>
>>> --
>>> 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 https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUgThuMtZvUj3QHxLKFHiRu67oTZuvfoLT3K9EpNt08Dg%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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/24038981-7076-4287-9a8d-31e3d83ab7d0%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...@googlegroups.com.
>>> To post to this group, send email to django...@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/a95743cd-8d68-4f92-91c9-c49ca7dfc329%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 

Re: count

2016-01-28 Thread aspellip
from django.http import HttpResponse
from django.template import loader, RequestContext

def foreginexchange_view(request):
t = loader.get_template("template.html")
test=ball.objects.filter(request="checked").count() 
c = RequestContext(request, {'test': test})
return HttpResponse(t.render(c))


On Wednesday, January 27, 2016 at 11:12:19 PM UTC+2, suabiut wrote:
>
> Version 1.7
>
> On Wed, Jan 27, 2016 at 10:42 PM,  wrote:
>
>> Which version of Django do you using?
>>
>> вторник, 26 января 2016 г., 23:14:03 UTC+2 пользователь suabiut написал:
>>>
>>> When i did that i got the error:
>>>
>>> 'dict' object has no attribute 'render_context'
>>>
>>>
>>>
>>> On Tue, Jan 26, 2016 at 7:25 PM,  wrote:
>>>
 Try this
 def foreginexchange_view(request):
 t = loader.get_template("template.html")
 test=ball.objects.filter(request="checked").count()
 return HttpResponse(t.render({'test': test}))

 On Tuesday, January 26, 2016 at 4:45:52 AM UTC+2, suabiut wrote:
>
> Thanks James,
> here is my view.py
>
> def foreginexchange_view(request):
> test=ball.objects.filter(request="checked").count()
> return render(request,'template.html',locals())
>
>
>
> Cheers
>
>
>
>
> On Tue, Jan 26, 2016 at 1:30 PM, James Schneider  
> wrote:
>
>>
>> On Jan 25, 2016 6:07 PM, "sum abiut"  wrote:
>> >
>> > Hi,
>> > i am trying to count the number of fields that has request field 
>> begin checked and then display the value of count in a template.html but 
>> i 
>> am not sure how to go about doing that.
>> >
>> > For example i want to do something like
>> >
>> > test=ball.object.filter(request="checked").count()
>> >
>> > then on a template.html i want to out put the value of test
>> >
>> > {{test}}
>> >
>> > i have try that but i am not getting any value from the output.
>> >
>>
>> Can you post your view? You would run that query in your view and 
>> then pass it to your template through the context.
>>
>> -James
>>
>> -- 
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUgThuMtZvUj3QHxLKFHiRu67oTZuvfoLT3K9EpNt08Dg%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 https://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/24038981-7076-4287-9a8d-31e3d83ab7d0%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...@googlegroups.com .
>> To post to this group, send email to django...@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/a95743cd-8d68-4f92-91c9-c49ca7dfc329%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 

Re: proxy model inheritance generates a migration file in a third party app

2016-01-28 Thread Markus Holtermann
Hello Iliana,

this is due to the definition of app_label = 'actstream' on your proxy 
model. This tells Django that this model should belong to another app. 
Hence the migrations involving that model are added to the actstream app's 
migrations.

/Markus


On Friday, January 29, 2016 at 10:14:24 AM UTC+11, Iliana Toneva wrote:
>
>  
> Hello,
>
> I am using a third party app actstream 
>  (
> https://github.com/justquick/django-activity-stream) and am creating a 
> proxy for one of the original actstream models :
>
> # myapp/models.py
> from actstream.models import Action
>
> # Subclass Action model and apply my own manager 
> class MyAction(Action):
> objects = MyActionManager()
>
> class Meta:
> proxy = True
> app_label = 'actstream'
>
>
> The issue that I am having is that when I run './manage.py makemigrations', 
> that creates a migration file 0002_myaction.py and adds it to the third party 
> app migrations (instead of adding it to myapp/migrations):
>
>
> *Migrations for 'actstream':*
>
>   *0002_myaction.py*:
>
> - Create proxy model MyAction
>
>
> # actstream/migrations/0002_myaction.py
>
> # -*- coding: utf-8 -*-
> from __future__ import unicode_literals
>
> from django.db import migrations, models
>
>
> class Migration(migrations.Migration):
>
> dependencies = [
> ('actstream', '0001_initial'),
> ]
>
> operations = [
> migrations.CreateModel(
> name='MyAction',
> fields=[
> ],
> options={
> 'proxy': True,
> },
> bases=('actstream.action',),
> ),
> ]
>
> Is there a way to prevent this behavior and force './manage.py 
> makemigrations' to create a migration file in myapp/migrations/ instead? 
>
> Many thanks,
> Iliana
>
>

-- 
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/4c72ac4c-34fb-433e-8d62-82c83855a8b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


proxy model inheritance generates a migration file in a third party app

2016-01-28 Thread Iliana Toneva
 
Hello,

I am using a third party app actstream 
 
(https://github.com/justquick/django-activity-stream) and 
am creating a proxy for one of the original actstream models :

# myapp/models.py
from actstream.models import Action

# Subclass Action model and apply my own manager 
class MyAction(Action):
objects = MyActionManager()

class Meta:
proxy = True
app_label = 'actstream'


The issue that I am having is that when I run './manage.py makemigrations', 
that creates a migration file 0002_myaction.py and adds it to the third party 
app migrations (instead of adding it to myapp/migrations):


*Migrations for 'actstream':*

  *0002_myaction.py*:

- Create proxy model MyAction


# actstream/migrations/0002_myaction.py

# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('actstream', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='MyAction',
fields=[
],
options={
'proxy': True,
},
bases=('actstream.action',),
),
]

Is there a way to prevent this behavior and force './manage.py 
makemigrations' to create a migration file in myapp/migrations/ instead? 

Many thanks,
Iliana

-- 
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/e9d0d1d0-9bf9-435c-b569-32c7a1bb2edb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Adding a field to a model after initial migration

2016-01-28 Thread Daniel Roseman
On Wednesday, 27 January 2016 21:29:18 UTC, ofeyofey wrote:
>
> No problem. Thanks for your help.
> Maybe fields can't be added to a model with django.
> I will try dropping the table in the DB and see what happens.
> Thanks again,
>

Adding fields to models is quite literally what migrations are for.
--
DR. 

-- 
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/7aa1bb2c-7ec3-4756-9a32-e6d3011743e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is Django appropriate for my project?

2016-01-28 Thread Fellipe Henrique
Hi,

On Thu, Jan 28, 2016 at 2:23 PM, Marisela Mainegra Hing <
mainegrah...@gmail.com> wrote:

> an online, database-supported application with appropriate skip-logic and
> delegation features to ensure the tool is user-friendly.
>
>It needs to be supported for mobile, lap-top and desk-top use.
>

Sure, Django can help you in your project.. but... most your requisites is
about Front-End, not backend (where django works)... be supported for
mobile, laptop, table etc.. is about frontend, ok?

Cheers!

T.·.F.·.A.·. S+F
*Fellipe Henrique P. Soares*

e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge'
*Fedora Ambassador: https://fedoraproject.org/wiki/User:Fellipeh
*
*Blog: *http:www.fellipeh.eti.br
*GitHub: https://github.com/fellipeh *
*Twitter: @fh_bash*

-- 
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/CAF1jwZE6eOWg3wZuhOBob%3DxOEVC2cbwkSedUmv%3DiPF8%2BNzKGLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Is Django appropriate for my project?

2016-01-28 Thread Marisela Mainegra Hing


Hello,

I am looking for a software to automate a Dashboard tool with the following 
requirements:

   an online, database-supported application with appropriate 
skip-logic and delegation features to ensure the tool is user-friendly.

   It needs to be supported for mobile, lap-top and desk-top use.

The delegation feature means that one survey may be answered by more than 
one person by assigning different questions to different respondents.

Is this something that could be implemented with Django? 

Thank you very much and have a great day,

Marisela

-- 
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/4e440880-889c-4aef-942d-af7d0cc3610c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: search page

2016-01-28 Thread pa xapy
queryset.filter(title__icontains=query) is not enough? 

On Wednesday, January 27, 2016 at 12:46:21 AM UTC+3, Xristos Xristoou wrote:
>
> hello,
>
>
> i want to an easy way to create search page on my site to searching only 
> the titles.
> who is the better and easy way for to doa that ?
> mayde some tools to install ?
> any idea ?
>

-- 
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/fce9069f-cc6b-4f8d-a0d8-97090107aecb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: RuntimeError: maximum recursion depth exceeded in cmp

2016-01-28 Thread palansh agarwal
Hey,
You may try to re-factor your code and turn it into an iterative one.
If that's not possible, try the following:

import  sys
> sys.setrecursionlimit(n)
>

Increase "n" as per your need.

Regards,

*Palansh Agarwal | +918239026608 |+919461787317
*

*http://www.palanshagarwal.com/ *

*CTO, Eventgraphia , India*
Team Lead IDC, *GoMobileFirst, USA*
Pre Final Year, B.Tech
The LNM Institute of Information Technology, Jaipur, India
[image: https://www.facebook.com/palansh.agarwal]

    [image:
https://github.com/py-geek] 

On Thu, Jan 28, 2016 at 1:24 PM, Deepak Singh  wrote:

> Hi,
>
> During (python manage.py runserver) command I am getting following error
>
>  File "C:\Python27\lib\functools.py", line 56, in 
> '__lt__': [('__gt__', lambda self, other: other < self),
>   File "C:\Python27\lib\functools.py", line 56, in 
> '__lt__': [('__gt__', lambda self, other: other < self),
>   File "C:\Python27\lib\functools.py", line 56, in 
> '__lt__': [('__gt__', lambda self, other: other < self),
> RuntimeError: maximum recursion depth exceeded in cmp
>
> Please guide me for neccessary step. I am running it first time.
>
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d8d7d91d-d80a-457b-8e72-71a91e7238bc%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPCyp%2B8E9%3DQ-Tie7javJaG5eS0DUmOR-SGoNNxry10TUifq4Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: RuntimeError: maximum recursion depth exceeded in cmp

2016-01-28 Thread Tim Graham
I've never seen that before. I think you'll need to provide a sample 
project that reproduces it so that someone can take a look.

On Thursday, January 28, 2016 at 7:45:31 AM UTC-5, Deepak Singh wrote:
>
> Hi,
>
> During (python manage.py runserver) command I am getting following error
>
>  File "C:\Python27\lib\functools.py", line 56, in 
> '__lt__': [('__gt__', lambda self, other: other < self),
>   File "C:\Python27\lib\functools.py", line 56, in 
> '__lt__': [('__gt__', lambda self, other: other < self),
>   File "C:\Python27\lib\functools.py", line 56, in 
> '__lt__': [('__gt__', lambda self, other: other < self),
> RuntimeError: maximum recursion depth exceeded in cmp
>
> Please guide me for neccessary step. I am running it first time.
>
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6dd721ad-6106-4f39-aff3-9e42bff4f9bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RuntimeError: maximum recursion depth exceeded in cmp

2016-01-28 Thread Deepak Singh
Hi,
   
During (python manage.py runserver) command I am getting following error

 File "C:\Python27\lib\functools.py", line 56, in 
'__lt__': [('__gt__', lambda self, other: other < self),
  File "C:\Python27\lib\functools.py", line 56, in 
'__lt__': [('__gt__', lambda self, other: other < self),
  File "C:\Python27\lib\functools.py", line 56, in 
'__lt__': [('__gt__', lambda self, other: other < self),
RuntimeError: maximum recursion depth exceeded in cmp

Please guide me for neccessary step. I am running it first time.

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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d8d7d91d-d80a-457b-8e72-71a91e7238bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: help with ManyToMany

2016-01-28 Thread dave.l
Hi,

I am happy with my models, and I'm fine inserting data, what I would like 
help with is retrieval.

given a single instance of a Studio() I can get 
studio.studiogroup_set.all() which I can then iterate to find the 
individual studios and build my resulting list ensuring no duplicates and 
not 'studio' itself. All this is working in Python:

choice = self.get_object()
others = []
for set in getattr(choice, "%s_set" % choice.groupname.lower()).all():
for other in getattr(set, choice.view_name()).exclude(pk=choice.pk):
if other not in others:
others.append(other)
for other in others:
print other

but this doesn't seem very elegant and I'm wondering if there's a more 
'django' way of doing this.

On Wednesday, January 27, 2016 at 8:36:26 PM UTC, Xristos Xristoou wrote:
>
> your code is correct,where are the problem ?in the admin first add Studio 
> and sfter this select on the field studio from class studiogroup one or 
> more entries from the class studio so simple,
>
> christos
>
> Τη Τετάρτη, 27 Ιανουαρίου 2016 - 5:50:21 μ.μ. UTC+2, ο χρήστης dave.l 
> έγραψε:
>>
>> Hi,
>>
>> I have recently returned to a Django project after a few years and I'm a 
>> little rusty on ManyToMany fields.
>>
>> Here's my very simple models:
>>
>>
>> class Studio(models.Model):
>> name = models.CharField(max_length=255, unique=True)
>>
>> class StudioGroup(models.Model):
>> description = models.CharField(max_length=255, unique=True)
>> studio = models.ManyToManyField(Studio)
>>
>>
>> So a bunch of Studio(), which can be in multiple StudioGroups()
>>
>> Given a single instance of a Studio(), I would like a single list of all 
>> other studios in all other groups.
>>
>> so if Group1 is A,B,C and Group2 is A,D,E
>>
>> I would like to return B,C,D,E for A.
>>
>> My current solution is entirely in Python (which works), but I'd like a 
>> more Django-esque solultion of possible!
>>
>> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7512817d-d348-48b2-abf1-f3f584650cce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.