Re: How to pass multiple query sets in Django?

2021-02-17 Thread Luciano Martins
show the sql you're trying to ... Em terça-feira, 16 de fevereiro de 2021 às 10:58:44 UTC-3, anilse...@gmail.com escreveu: > > How to pass multiple query sets in Django? > -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: how to pass multiple query sets in Django

2021-02-16 Thread Anil s
AttributeError when attempting to get a value for field `project_number` on serializer `ProjectListSerializer` please help me how to resolve this. Regards, Anil Sebastin On Tue, Feb 16, 2021 at 7:58 PM Omkar Parab wrote: > pass your multiple query sets using the get_context_data"

Re: how to pass multiple query sets in Django

2021-02-16 Thread Omkar Parab
pass your multiple query sets using the get_context_data" method.  https://docs.djangoproject.com/en/3.1/topics/class-based-views/generic-display/ On Tue, Feb 16, 2021, 7:28 PM Anil s wrote: > > Hello Everyone: > > Can somebody please tell me how to pass multiple que

how to pass multiple query sets in Django

2021-02-16 Thread Anil s
Hello Everyone: Can somebody please tell me how to pass multiple query sets in Django. Thank you for your help. -- 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, sen

How to pass multiple query sets in Django?

2021-02-16 Thread Anil s
How to pass multiple query sets in Django? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this

inspectDB and 'id' can only be used as a field name if the field also sets 'primary_key=True'.

2017-03-23 Thread Camilo Torres
Hi. You should rename the "id" field in your model to something else. You can edit your models.py and put another name, like "dbid" or something. Django models reserve the "id" field for primary key; your table has another field as primary key. -- You received this message because you are

inspectDB and 'id' can only be used as a field name if the field also sets 'primary_key=True'.

2017-03-23 Thread Carl Brewer
G'day, Very new to Django, I'm trying to connect to an existing MySQL database that I am not familiar with. I used inspectDB to load up the database models.py file, and am seeing these errors for some of the tables : 'id' can only be used as a field name if the field also sets 'primary_key

Strategies for apps dealing with large interdependent data sets

2016-03-04 Thread Larry Martell
I have to build an app that has many (~15) interdependent selection fields that come from large datasets across multiple different types of databases. For example, field A might have 10 values in a drop down, and when the user selects "FOO", then field B's drop down gets populated with 30 choices

Re: Two sets of registration with django-registration

2013-10-02 Thread Vibhu Rishi
hi I have updated and using All Auth now. I also liked it that i can do the social logins and the linkedin login seems to be working so far :) Can you point me to documentation on how to ovveride the methods ? I dont know so much about this part of django and am a bit at a loss in my

Re: Two sets of registration with django-registration

2013-09-23 Thread Vibhu Rishi
Thanks for the pointer. Will check out all auth. V. On Tue, Sep 24, 2013 at 4:03 AM, Kamil Gałuszka wrote: > > Of course. > > First of all I would recommend you using of django-allauth. They are > having great docs and they support custom user model. django-registration >

Re: Two sets of registration with django-registration

2013-09-23 Thread Kamil Gałuszka
Of course. First of all I would recommend you using of django-allauth. They are having great docs and they support custom user model. django-registration is little less maintained and maybe less suitable for your needs. First you define your custom form in settings.py: SIGNUP_FORM_CLASS Then

Two sets of registration with django-registration

2013-09-23 Thread Vibhu Rishi
Hi, I have 2 types of users with different views of the same page . Using django-registration, I have been able to setup all the signup/password change etc for one level of users - say students. Now I want to have another set of registrations for Teachers. Is there a way to achieve that ? Vibhu

Adding custom WHERE conditions to query sets (MySQL user defined functions)

2013-08-20 Thread Jon Dufresne
Hi, My Django application was ported from a legacy application. This legacy application has some MySQL user defined functions that are frequently used in the WHERE clause of queries. Is it possible to use these stored functions and still return query sets? I want to do something like

Re: linking the logged in user to other models to filter query sets -( noobie )

2013-05-30 Thread Joey Chang
you just give the user object to the form object in you view handler. some like: form = HeatingUserForm(user=request.user) or if have request POST data, you could do it like this: form = HeatingUserForm(request.POST, user=request.user) then: self.user = kwargs.pop('user')

Re: linking the logged in user to other models to filter query sets -( noobie )

2013-05-30 Thread tony gair
with the line self.user = kwargs.pop('user') do I need to import anything to access that the value 'user' ? On Wednesday, 29 May 2013 15:16:32 UTC, Tom Evans wrote: > > On Wed, May 29, 2013 at 3:29 PM, tony gair > wrote: > > > > > > I've done a basic django app

Re: linking the logged in user to other models to filter query sets -( noobie )

2013-05-29 Thread C. Kirby
Not knowing the specifics of your UserAccount model I will assume it has an organization = ForeignKeyField(Organization) In that case in your view you can just do: user_organization = request.user.organization and use that to filter the query On Wednesday, May 29, 2013 10:45:54 AM UTC-5, tony

Re: linking the logged in user to other models to filter query sets -( noobie )

2013-05-29 Thread tony gair
I think my first post was a bit messy and I left some information out I have an organisation as a foreign key contained in my abstact user object which is Heating_User. The premises also contains the organisation as a foreign key. What I am looking to do on my premises view is to filter the

Re: linking the logged in user to other models to filter query sets -( noobie )

2013-05-29 Thread Tom Evans
On Wed, May 29, 2013 at 3:29 PM, tony gair wrote: > > > I've done a basic django app with a user which contains an organisation and > premises foreign key inside the user model which has been inherited using > the features of django 1.5. > > I use the organisation id and

linking the logged in user to other models to filter query sets -( noobie )

2013-05-29 Thread tony gair
I've done a basic django app with a user which contains an organisation and premises foreign key inside the user model which has been inherited using the features of django 1.5. I use the organisation id and premises id inside other models which I would like to present themselves providing

Customizing the Admin by Grouping Sets

2013-02-04 Thread Mike Kaply
I apologize in advance if there is an obvious answer this. I'm totally new to Django and still trying to figure things out. We have a large set of data that will come in through Django - error reports from our product. What I'd like to have in the admin is that rather than showing all the

Re: passing multiple query sets into a url pattern

2012-02-19 Thread Stanwin Siow
Cheers bill! Figured it out already. However i'm stuck on the database problem which i wrote in a separate email. Stan Best Regards, Stanwin Siow On Feb 19, 2012, at 9:34 PM, Bill Freeman wrote: > Yes, you can, as part of the extra context, by whatever name doesn't > collide. Then you >

Re: passing multiple query sets into a url pattern

2012-02-19 Thread Bill Freeman
Yes, you can, as part of the extra context, by whatever name doesn't collide. Then you could use it in your template, in a "for" tag. You could also pass another one, by a name other than "queryset" at the same level as the first one, but that becomes an argument to the view, so don't expect it

Re: passing multiple query sets into a url pattern

2012-02-19 Thread Alfredo Alessandrini
Hi Stanwn, try this: def get_keyword(): return Keyword.objects.all() UserProfile_info = { "queryset" : UserProfile.objects.all(), "extra_context" : {"keyword_list" : get_keyword } } Now you can use the variable {{ keyword_list }} to populate the template. Alfredo 2012/2/19

Re: passing multiple query sets into a url pattern

2012-02-18 Thread Alfredo Alessandrini
Hi, I'm not sure that I've understand your question: url(r'^profile/(?P\d+)/(?P\d+)$', ..) and now you can use the variable var_1 and var_2 in your function. Alfredo 2012/2/18 Stanwin Siow > Hello, > > I want to find out if there is anyway to pass two

passing multiple query sets into a url pattern

2012-02-17 Thread Stanwin Siow
Hello, I want to find out if there is anyway to pass two querysets into a url pattern. i have this url pattern at the moment. UserProfile_info = { "queryset" : UserProfile.objects.all(), "extra_context" : {"keyword_list" : Keyword.objects.all} } url(r'^profile/$',

Re: Querying Exact Foreign Key Sets

2010-09-15 Thread Jason
s that contain only a > > certain set of Categories? > > > The 'in' operator doesn't do me any good. Excludes look like they are > > needed... > > > I'm in a situation where quickly sorting by SETS of categories is > > needed and I'm having a tough time. My databa

Re: Querying Exact Foreign Key Sets

2010-09-15 Thread Alec Shaner
wo models: > > Article > Category > > > Articles can have multiple categories. > > How would you go about finding the Articles that contain only a > certain set of Categories? > > The 'in' operator doesn't do me any good. Excludes look like they are > needed... > >

Querying Exact Foreign Key Sets

2010-09-14 Thread Jason
quickly sorting by SETS of categories is needed and I'm having a tough time. My database programming skills are pretty weak. I'm thinking of making an intermediate model called CategorySets. Articles would then have a relationship to a CategorySet and I can sort very easily on this. (note my

Re: how to avoid "in" query for large sets?

2010-05-24 Thread Euan Goddard
I've found the best way to solve these problems is to use a values_list queryset and inject the result of the into the outer query. Django is smart and doesn't actually evaluate the values_list query and instead injects that as a sub query in the SQL. However in this case can't you simply do:

Re: how to avoid "in" query for large sets?

2010-05-24 Thread J. Cliff Dyer
I believe you're confused. Your reply is to Tomasz, not to me. Also, my solution requires no model changes. Go back and look at it again. Cheers, Cliff On Mon, 2010-05-24 at 06:58 -0700, omat wrote: > @cliff: you are right, but i am writing an extension to an existing > app. i want to use

Re: how to avoid "in" query for large sets?

2010-05-24 Thread Tom Evans
On Mon, May 24, 2010 at 3:36 PM, Tom Evans wrote: > On Mon, May 24, 2010 at 3:23 PM, omat wrote: >> ops, this doesn't work, because the the Quiz model is pointing to the >> User model, and i want to filter on the quiz model and get the >> matching User

Re: how to avoid "in" query for large sets?

2010-05-24 Thread Tom Evans
On Mon, May 24, 2010 at 3:23 PM, omat wrote: > ops, this doesn't work, because the the Quiz model is pointing to the > User model, and i want to filter on the quiz model and get the > matching User instances. but in the example in the docs, the query is > on the parent model. > >

Re: how to avoid "in" query for large sets?

2010-05-24 Thread omat
ops, this doesn't work, because the the Quiz model is pointing to the User model, and i want to filter on the quiz model and get the matching User instances. but in the example in the docs, the query is on the parent model. quiz_qs = Quiz.objects.filter(score__gt=90)

Re: how to avoid "in" query for large sets?

2010-05-24 Thread omat
@cliff: you are right, but i am writing an extension to an existing app. i want to use the models as-is if possible. i found the part in the docs: inner_qs = Blog.objects.filter(name__contains='Cheddar') entries = Entry.objects.filter(blog__in=inner_qs) thanks. On May 24, 4:22 pm, Tomasz

Re: how to avoid "in" query for large sets?

2010-05-24 Thread Tomasz Zieliński
On 24 Maj, 08:58, Daniel Roseman wrote: > > User.objects.filter(id__in=Quiz.objects.filter(score__gt=90)) > Nice thing, is it documented somewhere (I think I haven't this before) ? -- Tomasz Zielinski http://pyconsultant.eu -- You received this message because you are

Re: how to avoid "in" query for large sets?

2010-05-24 Thread Daniel Roseman
On May 24, 1:12 pm, omat wrote: > Hi All, > > I have a Quiz model, which is related to the User model by a > ForeignKey. I want to get a queryset of users that have a certain > score. > > I want to avoid: > > User.objects.filter(id__in=[u.id for u in >

Re: how to avoid "in" query for large sets?

2010-05-24 Thread J. Cliff Dyer
What you are doing is querying the database once for each user to get their ID, because of your q.user.id. This means a million separate queries. You will be better off getting the id directly off the quiz table: User.objects.filter(id__in=[q.user_id for q in Quiz.objects.filter(score__gt=90)])

Re: how to avoid "in" query for large sets?

2010-05-24 Thread omat
ops, a small correction. i meant: User.objects.filter(id__in=[q.user.id for q in Quiz.objects.filter(score__gt=90)]) -- oMat On May 24, 3:12 pm, omat wrote: > Hi All, > > I have a Quiz model, which is related to the User model by a > ForeignKey. I want to get a queryset of

how to avoid "in" query for large sets?

2010-05-24 Thread omat
Hi All, I have a Quiz model, which is related to the User model by a ForeignKey. I want to get a queryset of users that have a certain score. I want to avoid: User.objects.filter(id__in=[u.id for u in Quiz.objects.filter(score__gt=90)]) As there are about 1 million users, this is deadly slow.

Re: Union of two query sets?

2010-02-21 Thread Dennis Kaarsemaker
On ma, 2010-02-15 at 18:22 -0800, ydjango wrote: > I have two query sets with two different where clause on same table > and same columns. Is it possible to have their union. > > I tried qryset = qryset1 + qryset2 - It gave me - "+ unsupported > argument" On

Union of two query sets?

2010-02-15 Thread ydjango
I have two query sets with two different where clause on same table and same columns. Is it possible to have their union. I tried qryset = qryset1 + qryset2 - It gave me - "+ unsupported argument" -- You received this message because you are subscribed to the Google Groups "Djan

Re: many permission sets for same user

2009-12-11 Thread Preston Holmes
On Dec 10, 8:41 am, Adonis <achrysoch...@hotmail.com> wrote: > Hi, > > I am trying to figure out the best way to do this. > I have built a django application where users are members in projects. > Thus, i need to assign users different permission sets that correspond &g

many permission sets for same user

2009-12-10 Thread Adonis
Hi, I am trying to figure out the best way to do this. I have built a django application where users are members in projects. Thus, i need to assign users different permission sets that correspond to different projects. The django core permission system cannot solve this by itself. I took a look

Re: "DeprecationWarning: the sets module is deprecated"

2009-05-27 Thread Alex Gaynor
n the syncdb command, I get this error: > > > > > > ch...@chris-desktop:~/Websites/jobmap$ python manage.py syncdb > > > > /var/lib/python-support/python2.6/MySQLdb/__init__.py:34: > > > > DeprecationWarning: the sets module is deprecated > > > >

Re: "DeprecationWarning: the sets module is deprecated"

2009-05-27 Thread kammi-agk
c...@pointy-stick.com> > wrote: > > > On Fri, 2009-05-01 at 14:59 -0700, nbv4 wrote: > > > Whenever I run the syncdb command, I get this error: > > > > ch...@chris-desktop:~/Websites/jobmap$ python manage.py syncdb > > > /var/lib/python-support/python2.6/MySQ

Re: "DeprecationWarning: the sets module is deprecated"

2009-05-01 Thread nbv4
r/lib/python-support/python2.6/MySQLdb/__init__.py:34: > > DeprecationWarning: the sets module is deprecated > >   from sets import ImmutableSet > > > I'm using Python 2.6 on Ununtu 9.04. I see this page: > >http://code.djangoproject.com/ticket/8078says the bug is fixed, but

Re: "DeprecationWarning: the sets module is deprecated"

2009-05-01 Thread Malcolm Tredinnick
On Fri, 2009-05-01 at 14:59 -0700, nbv4 wrote: > Whenever I run the syncdb command, I get this error: > > ch...@chris-desktop:~/Websites/jobmap$ python manage.py syncdb > /var/lib/python-support/python2.6/MySQLdb/__init__.py:34: > DeprecationWarning: the sets module is deprecate

Re: "DeprecationWarning: the sets module is deprecated"

2009-05-01 Thread Alex Koshelev
tes/jobmap$ python manage.py syncdb > /var/lib/python-support/python2.6/MySQLdb/__init__.py:34: > DeprecationWarning: the sets module is deprecated >  from sets import ImmutableSet > > I'm using Python 2.6 on Ununtu 9.04. I see this page: > http://code.djangoproject.com/ticket/8078

"DeprecationWarning: the sets module is deprecated"

2009-05-01 Thread nbv4
Whenever I run the syncdb command, I get this error: ch...@chris-desktop:~/Websites/jobmap$ python manage.py syncdb /var/lib/python-support/python2.6/MySQLdb/__init__.py:34: DeprecationWarning: the sets module is deprecated from sets import ImmutableSet I'm using Python 2.6 on Ununtu 9.04. I

Python object maker for database result sets

2009-04-14 Thread Sebastian
principles above, we have developed more complicated wrapper methods to handle multi-row return sets (using generators), as well as a grouping wrapper that returns multi-tiered objects. We welcome any feedback or comments on this approach. It would also be interesting to know why you would prefer to use a

Re: How can I filter query sets in a django template?

2009-04-08 Thread codecowboy
Thank you Daniel and Florian (Merci beaucoup. Je parle francais un petit). I think that I will be able to use both templates and custom model methods to accomplish what I am trying. On Apr 5, 4:18 pm, Daniel Roseman wrote: > On Apr 5, 8:49 pm, codecowboy

Re: How can I filter query sets in a django template?

2009-04-05 Thread Daniel Roseman
On Apr 5, 8:49 pm, codecowboy wrote: > I posted a question earlier today about circular imports (http:// > groups.google.com/group/django-users/t/6119e979131c8c25).  I now have > a follow question to that.  I've got the following view logic. > > def portal(request): >    

Re: How can I filter query sets in a django template?

2009-04-05 Thread Florian Strzelecki
Did you try to look at Inclusion Tag ? http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags In template you are not allowed to use some python code... but with an inclusion tag, you will be able to write this : {% load related_conferences %} {% related_conferences

How can I filter query sets in a django template?

2009-04-05 Thread codecowboy
I posted a question earlier today about circular imports (http:// groups.google.com/group/django-users/t/6119e979131c8c25). I now have a follow question to that. I've got the following view logic. def portal(request): scientist_id = 1 s = get_object_or_404(Scientist, pk=scientist_id)

Re: Customizing Admin for Large Data Sets

2009-02-18 Thread James Mowery
to > cope with large data sets. > > We need to deal with 500K plus records - and the loading times are > just too slow. > > Is it possible to show a limited number of recently added records ffor > a model, but then use the search facility in athe dmin to look for any > record in

Re: Customizing Admin for Large Data Sets

2009-02-17 Thread Jacob Kaplan-Moss
On Tue, Feb 17, 2009 at 12:15 PM, mermer <merme...@googlemail.com> wrote: > Does anybody have any advise on how best to customize the Admin to > cope with large data sets. > > We need to deal with 500K plus records - and the loading times are > just too slow. You might want

Customizing Admin for Large Data Sets

2009-02-17 Thread mermer
Does anybody have any advise on how best to customize the Admin to cope with large data sets. We need to deal with 500K plus records - and the loading times are just too slow. Is it possible to show a limited number of recently added records ffor a model, but then use the search facility

django sets Meta.fields to None

2009-02-03 Thread JonUK
I have the following class: class QuoteForm( ModelForm ): class Meta: fields = [ 'user', 'photo', 'created', 'usage', 'complete', ] model = Quote def __init__(self, *args, **kwargs ): import pdb; pdb.set_trace() super( QuoteForm, self ).__init__( *args,

Model manager not working with related sets of records.

2008-11-10 Thread John M
I have the following model (http://dpaste.com/89869/). The model is for a status report application I'm trying to create at work (so I don't have to do powerpoints). So each report, has several tasks / milestones associated with it. My problem is when I use a related set, the custom manager

Re: Sets

2008-07-20 Thread Cole Tuininga
>> On Sat, Jul 19, 2008 at 11:50 PM, Julien Phalip <[EMAIL PROTECTED]> wrote: >> > >> Oops - sorry, I wasn't very clear in my original request. I'm looking >> for a set type in the Django model hierarchy. Does this make more >> sense? > > A set is just an unordered collection of objects. In

Re: Sets

2008-07-20 Thread Cole Tuininga
On Sat, Jul 19, 2008 at 11:50 PM, Julien Phalip <[EMAIL PROTECTED]> wrote: > > 'set' is a Python standard object [1], since version 2.4. In version > 2.3 you need to import the 'Set' package first. > So, if you care about backward compatibility in Python, the most > secure way to import it is:

Re: Sets

2008-07-20 Thread Malcolm Tredinnick
On Sun, 2008-07-20 at 10:05 -0400, Cole Tuininga wrote: > On Sat, Jul 19, 2008 at 11:50 PM, Julien Phalip <[EMAIL PROTECTED]> wrote: > > > > 'set' is a Python standard object [1], since version 2.4. In version > > 2.3 you need to import the 'Set' package first. > > So, if you care about backward

Re: Sets

2008-07-20 Thread Karen Tracey
On Sun, Jul 20, 2008 at 10:05 AM, Cole Tuininga <[EMAIL PROTECTED]> wrote: > > On Sat, Jul 19, 2008 at 11:50 PM, Julien Phalip <[EMAIL PROTECTED]> wrote: > > > > 'set' is a Python standard object [1], since version 2.4. In version > > 2.3 you need to import the 'Set' package first. > > So, if you

Re: Sets

2008-07-19 Thread Julien Phalip
'set' is a Python standard object [1], since version 2.4. In version 2.3 you need to import the 'Set' package first. So, if you care about backward compatibility in Python, the most secure way to import it is: try: set except NameError: from sets import Set as set # Python 2.3 fallback

Sets

2008-07-19 Thread Cole Tuininga
Quick question for you folks - is there a native "set" type in the Django model system? I'm currently on 0.96.1. Thanks! -- Cole Tuininga http://www.tuininga.org/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Displaying sets of data in-line together

2008-06-25 Thread truebosko
This may be kind of hard to explain but what I am trying to accomplish in Django is this: I have 2 possible sets of data (It can also be one, depending on what's easiest) #1 is Reviews where FOO = X #2 is Reviews where FOO = Y Each Review contains several category type fileds. Summary, Value

Re: What's the best way to handle big sets of data?

2007-10-01 Thread Bruno Tikami
tests BEFORE writing my Django project. Tks ! Tkm On 9/25/07, Tim Chase <[EMAIL PROTECTED]> wrote: > > > > I'm developing a Django project that's going to handle with > > big sets of data and want you to advise me. I have 10 internal > > bureaus and each of th

Re: What's the best way to handle big sets of data?

2007-09-25 Thread Tim Chase
> I'm developing a Django project that's going to handle with > big sets of data and want you to advise me. I have 10 internal > bureaus and each of then has a 1.5 million registers database > and it really looks to keep growwing on size on and on. I > intend to use Postgres. &g

Re: What's the best way to handle big sets of data?

2007-09-25 Thread Richard Dahl
ful in getting large amounts of data from the server to the client in > > small efficient chunks, if the network transfer issue is high on your list. > > -richard > > > > > > On 9/25/07, Bruno Tikami < [EMAIL PROTECTED]> wrote: > > > > > > Hi fellows

Re: What's the best way to handle big sets of data?

2007-09-25 Thread Bruno Tikami
t; -richard > > > On 9/25/07, Bruno Tikami <[EMAIL PROTECTED]> wrote: > > > > Hi fellows, > > > > I'm developing a Django project that's going to handle with big sets of > > data and want you to advise me. I have 10 internal bureaus and each of then &g

Re: What's the best way to handle big sets of data?

2007-09-25 Thread Richard Dahl
to the client in small efficient chunks, if the network transfer issue is high on your list. -richard On 9/25/07, Bruno Tikami <[EMAIL PROTECTED]> wrote: > > Hi fellows, > > I'm developing a Django project that's going to handle with big sets of > data and want you to advise me. I hav

What's the best way to handle big sets of data?

2007-09-25 Thread Bruno Tikami
Hi fellows, I'm developing a Django project that's going to handle with big sets of data and want you to advise me. I have 10 internal bureaus and each of then has a 1.5 million registers database and it really looks to keep growwing on size on and on. I intend to use Postgres. The question

Re: Accessing FK sets in model methods

2007-07-19 Thread Ilan
Correct. I over looked a few basics. On 19 יולי, 04:58, "Ben Ford" <[EMAIL PROTECTED]> wrote: > This error message is to do with a syntax error... It doesn't have anything > to do with django specifically. If you've cut and pasted verbatim, then you > need a colon ( : ) at the end of your if

Re: Accessing FK sets in model methods

2007-07-18 Thread Ben Ford
This error message is to do with a syntax error... It doesn't have anything to do with django specifically. If you've cut and pasted verbatim, then you need a colon ( : ) at the end of your if > 0 line. This is what python is flagging as an error as far as i can see. Ben On 18/07/07, Ilan

Re: Accessing FK sets in model methods

2007-07-18 Thread Ilan
You're correct I did have a extra space, but the original problem was syntax error on the following line : if self.segment_set.count() > 0 so my question is : can I acess to FK queryset as described in http://www.djangoproject.com/documentation/db-api/#Backward in a model method thanks On 18

Re: Accessing FK sets in model methods

2007-07-18 Thread Tim Chase
> Can someone point me to the problem? > > class Base(models.Model): > User = models.CharField(maxlength=200) > Notes = models.CharField(maxlength=200) # free text > > def _first_date(self): >""" Return the first date """ > if self.segment_set.count() > 0 >

Accessing FK sets in model methods

2007-07-18 Thread Ilan
Hi, My name is Ilan, and I kind of new working with Django. I have a question about model methods. I trying to write a model method which access ForeignKey FOO_set functionality Whoever it does not seems to pass the "syncdb" validation, because of invalid syntax Can someone point me to the

Re: trying to setup field sets in admin, keep getting error

2007-03-30 Thread James Bennett
On 3/30/07, drackett <[EMAIL PROTECTED]> wrote: > I see.. if there were more than one item in there, the last comma > isn't necessary anymore, correct? Correct. The comma is needed on a single-element tuple so that Python can distinguish between something that's in parentheses for grouping

Re: trying to setup field sets in admin, keep getting error

2007-03-30 Thread drackett
I see.. if there were more than one item in there, the last comma isn't necessary anymore, correct? ('more', { 'classes': 'collapse', 'fields' : ('entry_date', 'entry_something') }), On Mar 30, 2:50 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 3/30/07, drackett <[EMAIL PROTECTED]>

Re: trying to setup field sets in admin, keep getting error

2007-03-30 Thread James Bennett
On 3/30/07, drackett <[EMAIL PROTECTED]> wrote: > ('more', { 'classes': 'collapse', 'fields' : > ('entry_date') }), This line is the culprit; change it to ('more', { 'classes': 'collapse', 'fields' : ('entry_date',) }), Take note of the comma after 'entry_date'. The

trying to setup field sets in admin, keep getting error

2007-03-30 Thread drackett
I am trying to setup field sets on my first project, however, when I add the admin section below, I get the error "My_blog has no field named 'e' " This error goes away if I remove the "fields=" from below. I got the code straight from the documentation, what am I doing wrong

trying to setup field sets in admin, keep getting error

2007-03-30 Thread drackett
I am trying to setup field sets on my first project, however, when I add the admin section below, I get the error "My_blog has no field named 'e' " This error goes away if I remove the "fields=" from below. I got the code straight from the documentation, what am I doing wrong

Re: Nested Sets for trees - any models been made before?

2007-03-27 Thread Jonas Maurus
On Mar 27, 2:10 pm, "Nathan Harmston" <[EMAIL PROTECTED]> wrote: > HI, > > Currently I am trying to store a "tree" in a database and want to use Nested > Sets in order to do this. I was wondering if this exists within Django atm > or if there are pla

Re: Nested Sets for trees - any models been made before?

2007-03-27 Thread Steven Armstrong
Nathan Harmston wrote on 03/27/07 14:10: > HI, > > Currently I am trying to store a "tree" in a database and want to use Nested > Sets in order to do this. I was wondering if this exists within Django atm > or if there are plans to add it in the future or has someone d

Re: Nested Sets for trees - any models been made before?

2007-03-27 Thread Atilla
> Currently I am trying to store a "tree" in a database and want to use Nested > Sets in order to do this. I was wondering if this exists within Django atm > or if there are plans to add it in the future or has someone developed it on > the side? If the ans

Nested Sets for trees - any models been made before?

2007-03-27 Thread Nathan Harmston
HI, Currently I am trying to store a "tree" in a database and want to use Nested Sets in order to do this. I was wondering if this exists within Django atm or if there are plans to add it in the future or has someone developed it on the side? If the answer to these

Re: Empty related sets = Page not found?

2007-01-11 Thread Brian Beck
John Matthew wrote: > Thank you for the reply. No problem. :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To

Re: Empty related sets = Page not found?

2007-01-11 Thread John Matthew
Thank you for the reply. On 1/10/07, Brian Beck <[EMAIL PROTECTED]> wrote: > > > Hi, > > object_list takes an allow_empty argument, try settings it to True. > >From the docs: > > allow_empty: A boolean specifying whether to display the page if no > objects are available. If this is False and no

Re: Empty related sets = Page not found?

2007-01-10 Thread John M
Yup, that did it! Thanks again Brian! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send

Re: Empty related sets = Page not found?

2007-01-10 Thread John M
Brian Beck wrote: > Hi, > > object_list takes an allow_empty argument, try settings it to True. > >From the docs: > > allow_empty: A boolean specifying whether to display the page if no > objects are available. If this is False and no objects are available, > the view will raise a 404 instead of

Re: Empty related sets = Page not found?

2007-01-10 Thread Brian Beck
Hi, object_list takes an allow_empty argument, try settings it to True. >From the docs: allow_empty: A boolean specifying whether to display the page if no objects are available. If this is False and no objects are available, the view will raise a 404 instead of displaying an empty page. By

Empty related sets = Page not found?

2007-01-10 Thread John M
OK, again I'm stumpped. I have the following models: class Portfolio(models.Model): user= models.ForeignKey(User) description = models.CharField(maxlength=50) notes = models.CharField(maxlength=200) class Holding(models.Model): porfolio =

Re: Using query sets to get a filtered list across models

2006-10-29 Thread Russell Keith-Magee
On 10/30/06, Ceph <[EMAIL PROTECTED]> wrote: > > What I need to pull is a list of Items using the data from the Render > model that represents the latest Revision of an Item. I am currently > doing this easily with raw SQL, but this seems like something that > Django should be able to do for me.

Using query sets to get a filtered list across models

2006-10-29 Thread Ceph
I followed the tutorials and have gone through the manual (all nicely written, by the way), but I'm having trouble trying to wrap my head around using Query Sets to get myself through this. I have the following (abbreviated) models: class Item( models.Model ): pass class Render

Re: python sets and objects returned in queries

2006-08-29 Thread Gary Wilson
Ivan Sagalaev wrote: > Gary Wilson wrote: > > Why can't objects be used in python sets? Example: > > > >>>> [u.username for u in User.objects.all()] > > ['bar', 'foo', 'foobar'] > >>>> a = User.objects.filter(username__contains='foo') >

Re: python sets and objects returned in queries

2006-08-29 Thread Ivan Sagalaev
Gary Wilson wrote: > Why can't objects be used in python sets? Example: > >>>> [u.username for u in User.objects.all()] > ['bar', 'foo', 'foobar'] >>>> a = User.objects.filter(username__contains='foo') >>>> b = User.objects.filter(username__contai

python sets and objects returned in queries

2006-08-28 Thread Gary Wilson
Why can't objects be used in python sets? Example: >>> [u.username for u in User.objects.all()] ['bar', 'foo', 'foobar'] >>> a = User.objects.filter(username__contains='foo') >>> b = User.objects.filter(username__contains='bar') >>>

Re: mysql - collation and character sets..

2006-03-13 Thread [EMAIL PROTECTED]
i am still not following this.. here is the output from my show variables.. mysql> SHOW VARIABLES LIKE 'char%'; +--++ | Variable_name| Value | +--++ |

Re: mysql - collation and character sets..

2006-03-11 Thread Geert Vanderkelen
the > admin site? When connecting to MySQL you need to specify which encoding you are going to use to get results and send data. Right now, Django's MySQL backend sets this to UTF8 when the server is MySQL 4.1 or higher. There are talks/posts which discuss to make this configurable. I think

Re: mysql - collation and character sets..

2006-03-10 Thread Eugene Lazutkin
[EMAIL PROTECTED] wrote: > > what character set and collation does django expect when setting up the > admin site? I use MySQL's defaults: charset is "latin1", collation is "latin1_swedish_ci". Everything works properly. But I never tried non-English admin. Maybe i18n users can provide more

  1   2   >