Re: Optimal query for related names in onetomany or manytomany using Django Queryset

2018-02-03 Thread Furbee
You can set up an index on multiple field, as well, so if you’re searching for As without a reference from B or C, using the index_together operative in the class Meta for that model. I’m not completely sure, but I think this may speed up you query time. Thanks, Furbee On Saturday, February 3

Re: Optimal query for related names in onetomany or manytomany using Django Queryset

2018-02-02 Thread Furbee
et a response from your DB. You can also write raw SQL, if you can make one more efficiently. Furbee On Fri, Feb 2, 2018 at 10:56 AM, Vijay Khemlani <vkhem...@gmail.com> wrote: > "with large of records in A and B, the above takes lot of time" > > How long? At first gla

Re: Can you people explain why the def _str_() method is used below?

2018-01-09 Thread Furbee
Who you call "you people?" Just kidding. On Tue, Jan 9, 2018 at 11:27 AM, wrote: > Thanks alot James and Projec.Your posts were very helpful to me. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To

Re: How to check if user is already in user database?

2015-01-16 Thread Mark Furbee
Also, you can do a try/catch, but I don't really like this method, personally: try: User.objects.get(username=username) except User.DoesNotExist: # user didn't exist in database. On Fri, Jan 16, 2015 at 9:16 AM, Mark Furbee <markfur...@gmail.com> wrote: > Yes,

Re: How to check if user is already in user database?

2015-01-16 Thread Mark Furbee
Yes, that link will cover the basics... Here's a couple ways to find out if a query returns any records: User.objects.filter(username=username).exists() # .exists() returns boolean if records are found. User.objects.filter(username=username).count() != 0 # .count() returns number of

Re: ANN: Django website redesign launched

2014-12-16 Thread Mark Furbee
Looks slick to me! Clearly with mobile and responsive design in mind, but that's what we have to keep in mind these days. Great job to all contributors involved in this redesign! On Tue, Dec 16, 2014 at 4:01 PM, Cal Leeming wrote: > > Personally I really like it. > > The footer

Re: (1364, "Field 'id' doesn't have a default value") - mysql issue?

2014-04-09 Thread Mark Furbee
You say you imported the database. Did you use syncdb to set up the tables? It sounds like your comment_id field in MySQL is not set as an auto-incrementing primary key field. Do you have access to that MySQL database to check, and or update that field definition? On Wed, Apr 9, 2014 at 2:42 PM,

Re: I really about to give up Django

2013-08-23 Thread Mark Furbee
I see. I don't understand how this works: {{ itens.instance.idproduto.codigobarra }} when this doesn't: {{ itens.instance.idproduto.idmercadoria.referencia }} Can you post your template code? On Fri, Aug 23, 2013 at 10:13 AM, Fellipe Henrique wrote: > form.instance is

Re: I really about to give up Django

2013-08-23 Thread Mark Furbee
Are you sure the idmercadoria is not None on that idproduto record? {{ form.instance.idproduto.**idmercadoria }} Does this display anything? How about {{ form.instance.idproduto }}? If these don't display, verify the records in your database. In Django templates, if something is None or does not

Re: I really about to give up Django

2013-08-22 Thread Mark Furbee
Are your "nome" and "idade" fields displaying? If so, {{ form.instance.brinq.descricao }} should display the descricao field of the brinq object associated with that Filhos instance bound to the form in the formset. On Thu, Aug 22, 2013 at 9:24 AM, Fellipe Henrique wrote: >

Re: I really about to give up Django

2013-08-22 Thread Mark Furbee
Try dropping the .value from referencia. Like {{ form.instance.idproduto.idmercadoria.referencia }}. Does this work? On Thu, Aug 22, 2013 at 9:35 AM, Fellipe Henrique wrote: > I tried again.. and work if I have just 1 FK, if I have more then one, > doesn't work, like this: >

Re: 'url' template tag throws and error after upgrading to 1.4

2013-04-04 Thread Mark Furbee
Can you run manage.py shell and connect to 'views?' On Thu, Apr 4, 2013 at 4:13 PM, Mark Furbee <markfur...@gmail.com> wrote: > It would appear to me that your missing the path to django in your > environment. When you upgraded did you also upgrade to another version of >

Re: 'url' template tag throws and error after upgrading to 1.4

2013-04-04 Thread Mark Furbee
It would appear to me that your missing the path to django in your environment. When you upgraded did you also upgrade to another version of Python, perhaps? Is the dist-packages/site-packages django folder in the same place it was? On Thu, Apr 4, 2013 at 3:58 PM, Bastian

Re: ANNOUNCE: Django 1.5 released

2013-02-26 Thread Mark Furbee
Woo-hoo! Awesome news. We really appreciate all the hard work you guys have been doing getting this version out. Thanks a million! Mark On Tue, Feb 26, 2013 at 11:44 AM, James Bennett wrote: > Yup, it's finally here! > > * Announcement blog post here: >

Re: Saving browser output as pdf

2013-02-24 Thread Mark Furbee
Django docs (pretty turse): https://docs.djangoproject.com/en/dev/howto/outputting-pdf/ >From ReportLab site: http://www.reportlab.com/software/documentation/ Here's a decent quick tutorial: http://www.blog.pythonlibrary.org/2010/03/08/a-simple-step-by-step-reportlab-tutorial/ Note that what

Re: Saving browser output as pdf

2013-02-24 Thread Mark Furbee
Mike DeWitt's answer is most appropriate. In you view define an argument 'pdf=False' and when returning the response from uou view, if pdf is False, return regular HttpResponse. If pdf is True, follw @Mike's reply to set response Content type to PDF. It is really easy to return what would be an

Re: can someone rewrite this line please

2013-02-21 Thread Mark Furbee
No worries, Mike. Any time! On Thu, Feb 21, 2013 at 3:17 AM, MikeKJ wrote: > Thank you Mark spot on! > > Really appreciate it > > > > > > On Wednesday, February 20, 2013 3:58:28 PM UTC, Mark wrote: > >> Not sure if you need the json.large to be compiled or if that

Re: can someone rewrite this line please

2013-02-20 Thread Mark Furbee
Not sure if you need the json.large to be compiled or if that should be part of the string. The biggest issue was you had a single-quote before onmouseover. After that, you have to escape the single-quote before \',LEFT, true, OFFSETY, -250, OFFSETX, 0, WIDTH, 800)\" target=\"_blank\">'; FYI: if

Re: DJANGO_DEFAULT_SETTINGS

2012-08-14 Thread Furbee
the tutorials and documentation, especially Tutorial 1-4. This will get you on your way to installing and using Django via the web, and shell. Furbee On Tue, Aug 14, 2012 at 2:50 PM, Jirka Vejrazka <jirka.vejra...@gmail.com>wrote: > > right, I was being very brief in my

Re: Database Error at /admin/coltrane/entry/add/

2012-05-16 Thread Furbee
. However, South will implement changes to table structure, and it is actually incredibly easy to set up! Happy Coding, Furbee On Wed, May 16, 2012 at 1:21 AM, Gethin Llyn ab Alwyn <geth...@gmail.com>wrote: > Thank you for your answer, deleting the table and running manage.py syn

Re: Database Error at /admin/coltrane/entry/add/

2012-05-15 Thread Furbee
manage.py syncdb to have it recreated including this field. Furbee On Tue, May 15, 2012 at 8:57 AM, Gethin Llyn ab Alwyn <geth...@gmail.com>wrote: > Hello all! > > I'm following James Bennett's book Practical Django Projects, and I've got > stuck at page 65 Chapt

Re: Middleware order

2012-05-15 Thread Furbee
I don't know, but the revision middleware smells like it could be the culprit. It is the last module in processing the request, and the first one processing the response back up the chain. Maybe it is returning the old data. Just a stab in the dark. Furbee On Tue, May 15, 2012 at 8:23 AM, David

Re: Dajaxice is not defined!!! please heelpppp!! :(

2012-05-04 Thread Furbee
thinking everything went through fine since it is input from their perspective correctly. Cheers, Furbee On Fri, May 4, 2012 at 8:48 AM, Tom Evans <tevans...@googlemail.com> wrote: > On Fri, May 4, 2012 at 4:06 PM, doniyor <doniyor@googlemail.com> > wrote: > > if i c

Re: where did I install Django

2012-03-20 Thread Furbee
>From an answer on stackoverflow.com ( http://stackoverflow.com/questions/122327/how-do-i-find-the-location-of-my-python-site-packages-directory ): Enter python shell by executing python binary: from distutils.sysconfig import get_python_lib print(get_python_lib()) It usually resides

Re: Getting URL from within a template

2012-03-14 Thread Furbee
Gotcha, you are filtering the QuerySet in Django, returning to client, and further filtering with jQuery. Makes sense now. :-) Happy Coding! Furbee On Wed, Mar 14, 2012 at 2:11 PM, Larry Martell <larry.mart...@gmail.com>wrote: > On Tue, Mar 13, 2012 at 4:26 PM, Furbee <furbeena.

Re: Getting URL from within a template

2012-03-13 Thread Furbee
Oh, you are filtering in the template, using Django, sorry. I thought you meant you pass it to the template and use jQuery to filter. My bad. :-) Cheers On Tue, Mar 13, 2012 at 3:25 PM, Furbee <furbeena...@gmail.com> wrote: > Aha! Very nice. As a sidebar, you said you pass the filt

Re: Getting URL from within a template

2012-03-13 Thread Furbee
;wrote: > On Tue, Mar 13, 2012 at 3:53 PM, Furbee <furbeena...@gmail.com> wrote: > > Gotcha, I was unclear. You can have jQuery modify the URL without > actually > > requesting the page from the webserver, I thought that was what you > meant. > > This comes in handy wh

Re: Getting URL from within a template

2012-03-13 Thread Furbee
com>wrote: > On Tue, Mar 13, 2012 at 3:33 PM, Furbee <furbeena...@gmail.com> wrote: > > Good deal, but if you send the page to the client, then jQuery updates > the > > URL, the {{ request.get_full_path }} is still only able to have the > original > > URL th

Re: Getting URL from within a template

2012-03-13 Thread Furbee
to get updated details. Cheers On Tue, Mar 13, 2012 at 2:23 PM, Larry Martell <larry.mart...@gmail.com>wrote: > On Tue, Mar 13, 2012 at 2:19 PM, Furbee <furbeena...@gmail.com> wrote: > > Hi Larry, > > > > render_to_response is one of many ways to return an HttpRes

Re: Getting URL from within a template

2012-03-13 Thread Furbee
luck, Furbee On Tue, Mar 13, 2012 at 11:57 AM, Larry Martell <larry.mart...@gmail.com>wrote: > On Tue, Mar 13, 2012 at 12:38 PM, Furbee <furbeena...@gmail.com> wrote: > > I think you want to actually get these in the view code and pass them to > the > > template a

Re: Getting URL from within a template

2012-03-13 Thread Furbee
'], 'filterValue': request.GET['_filterValue']}, context_instance=RequestContext(request)) >From the template, now, the different variables are available. {{ date_time }}, {{ submit_preview }}, {{ event_type }}, {{ filterValue }}. That's how I would handle it at least. Furbee On Tue, Mar 13, 2012 at 11

Re: Calling "manage.py shell" from the Python Shell in Tutorial Part 1

2012-02-21 Thread Furbee
your models.py and settings.py files for any lines that are indented which are not supposed to be. Furbee On Tue, Feb 21, 2012 at 3:41 PM, Django_for_SB <sami.balb...@gmail.com>wrote: > Django Gurus, > > I'm an absolute beginner using Python in Django. I'm currently going > through

Re: I am getting TypeError: coercing to Unicode: need string or buffer, long found. Please help.

2012-02-20 Thread Furbee
As an aside, I would assume you want your phone number field to be a string (models.CharField) instead of integer. Furbee On Mon, Feb 20, 2012 at 2:39 PM, Babatunde Akinyanmi <tundeba...@gmail.com>wrote: > @Daniel > Your __unicode__ should always return a string so like Shawn said

Re: templates not updating when i change things please help

2012-02-19 Thread Furbee
browsing session to remove cache from the picture. In IE, go to File > New Session, or go to In Private browsing, in Chrome go new Incognito browser (Ctrl + Shift + N). That's been my experience, at least. Furbee On Sun, Feb 19, 2012 at 6:53 AM, Rich <richwand...@gmail.com> wrote: > Hi

Re: DATABASE in settings file not working

2012-02-17 Thread Furbee
That is strange. This probably won't help, but try deleting the settings.pyc file and then run python manage.py runserver again (without --settings=settings). Furbee On Fri, Feb 17, 2012 at 7:45 AM, Babatunde Akinyanmi <tundeba...@gmail.com>wrote: > Yes I do get it. I didn't realize t

Re: Dumb newbie question

2012-02-17 Thread Furbee
, defs, constants, does not import anything from the module that you are importing into. Funny things happen, when you have circular imports, and when you are beginning out they can be hard to troubleshoot. Furbee On Fri, Feb 17, 2012 at 7:43 AM, Bob Carlson <b...@rjcarlson.com> wrote: >

Re: import problem

2012-02-17 Thread Furbee
if there was something with your environment that was using an old copy of the file without the import, because your syntax sounded perfect. Anyway, I'm glad you got it figured out! Furbee On Thu, Feb 16, 2012 at 6:33 PM, Dennis Lee Bieber <wlfr...@ix.netcom.com>wrote: > On Thu, 16 Feb 2012 21:00:40 -05

Re: import problem

2012-02-16 Thread Furbee
He said he would do that later tonight. Furbee On Thu, Feb 16, 2012 at 2:04 PM, Dennis Lee Bieber <wlfr...@ix.netcom.com>wrote: > On Thu, 16 Feb 2012 13:41:32 -0500, Scott Macri <scottma...@gmail.com> > wrote: > > >I don't believe I have any circular imports in my cod

Re: import problem

2012-02-15 Thread Furbee
Can you reply with the actual NameError Exception? Like: NameError: globalname 'datetime' is not defined, or whatever it is. From the module that is throwing this error are you importing anything else that is importing an overridden date method or datetime object? You can also try this (instead

Re: Where are the 2+ places user_id is defined?

2012-02-15 Thread Furbee
there is already a user profile with that user_id in the database. If you are currently developing, then the easiest thing to do is to drop the user profile table and let syncdb recreate it. Alternatively you could delete the unneeded user profiles in the shell. Furbee On Wed, Feb 15, 2012 at 3

Re: What is the best type of wood to use for staking vampires?

2012-02-15 Thread Furbee
Ha ha ha, that's funny! On Wed, Feb 15, 2012 at 12:44 PM, James Pyrich <ja...@pyrich.com> wrote: > On 2/15/12 1:28 PM, Dennis Lee Bieber wrote: > >> On Wed, 15 Feb 2012 11:45:51 -0800, Furbee<furbeena...@gmail.com> >> wrote: >> >> Is this posting a zom

Re: what is the best IDE to use for Python / Django

2012-02-15 Thread Furbee
Is this posting a zombie? It doesn't seem to ever die no matter what we do to kill it! :-) Furbee On Wed, Feb 15, 2012 at 10:09 AM, <adesantoas...@gmail.com> wrote: > ** > @Sanders, nice answer :D, SOL > +adesst > -- > *From: * Thorsten S

Re: Speficy a Database for Testing

2012-02-08 Thread Mark Furbee
wrote: > Yes, but django makes a new testDatabase and that's my problem, I want > django to use a database I've previously done. > > > On 8 February 2012 16:34, Mark Furbee <markfur...@gmail.com> wrote: > >> Denis Darii already answered this on February 1st: >> >

Re: Speficy a Database for Testing

2012-02-08 Thread Mark Furbee
Denis Darii already answered this on February 1st: "You can redefine your database connection by adding somewhere at the end of your settings.py something like: import sys if 'test' in sys.argv: DATABASES = ... hope this helps." Did you try this? On Wed, Feb 8, 2012 at 7:19 AM, xina

Re: create users from /etc/passwd?

2012-02-02 Thread Furbee
something similar to this and it works perfectly.: http://onecreativeblog.com/post/59051248/django-login-required-middleware You're want to study up on how middleware works, here: https://docs.djangoproject.com/en/1.3/topics/http/middleware/ Good Luck, Furbee On Thu, Feb 2, 2012 at 7:

Re: Testing

2012-01-31 Thread Furbee
I think you can do something like: assertTrue(first == one_value or first == second_value) At the same time, when unit testing, you should really know exactly what a value returned from a method is. Furbee On Tue, Jan 31, 2012 at 4:32 PM, xino12 <xinatow...@gmail.com> wrote: > H

Re: Having Headache With LoginForm

2012-01-19 Thread Mark Furbee
that? > > Mark Furbee wrote: > > This is my login process. > > > > urls.py: > > url(r'^login$', 'views.Login'), > > url(r'^logout$', 'views.Logout'), > > > > > > views.py: > > def Login(request, next=None): > > "&

Re: Having Headache With LoginForm

2012-01-18 Thread Mark Furbee
arning %} {% WarnImage %} {{ warning }} {% endif %} {% if notice %} {% NoticeImage %} {{ notice }} {% endif %} Email address: Password: On Wed, Jan 18, 2012 at 8:09 AM, Mark Furbee <markfur...@gmail.com> wrote: > Is that template mainpage.html? &g

Re: Having Headache With LoginForm

2012-01-18 Thread Mark Furbee
, but its not working! Any help? > > On Jan 17, 10:37 pm, Mark Furbee <markfur...@gmail.com> wrote: > > It means, don't use the "decorator" @login_required above your login > view. > > Your login view cannot require a login, because you'd never get to log > in.

Re: Having Headache With LoginForm

2012-01-17 Thread Mark Furbee
It means, don't use the "decorator" @login_required above your login view. Your login view cannot require a login, because you'd never get to log in. Chicken and egg. On Tue, Jan 17, 2012 at 2:34 PM, coded kid wrote: > > > Thorsten Sanders wrote: > > With using > > > >

Re: Need to examine and act on old vs. new at .save() time

2012-01-12 Thread Furbee
. I'm not sure this would work for you, but it might be an alternative, although it violates the DRY principle. Furbee On Thu, Jan 12, 2012 at 9:20 AM, Jeff <jbla...@mitre.org> wrote: > > On Jan 11, 9:23 pm, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote: > > On Wed, 11

Re: no plus-sign to add related object in admin

2011-12-29 Thread Furbee
Just taking a stab in the dark, are the ones without the + sign editable in the Admin? If they are not editable, I would imagine Django would not show the + in the Admin. Furbee On Thu, Dec 29, 2011 at 12:58 PM, K.C. Smith <kevchr...@gmail.com> wrote: > I've got a project where when

Re: Successful login to go back to the page login was initiated from

2011-12-16 Thread Furbee
Thanks for sharing the answer, I was sort of wanting to figure this out long term, just haven't gotten to it, yet. Furbee On Fri, Dec 16, 2011 at 4:33 PM, bazaarsoft <jay_mar...@me.com> wrote: > Never mind, found the answer: > > http://efreedom.com/Question/1-806835/Django-Re

Re: Can a template extend a template?

2011-12-13 Thread Furbee
Brilliant! I wasn't looking an answer to this question, and wasn't all that aware of how these interacted, but it will sure come in handy. Thanks for the extremely clear, concise explanation. I don't think the Django docs make it quite that clear. Furbee On Tue, Dec 13, 2011 at 3:49 PM, Russell

Re: How to change the representation of newline?

2011-12-13 Thread Furbee
-in-python. You can use ord() and chr() to switch carriage return/line feeds using the ascii ordinal representation and back if you need to. Furbee 2011/12/13 Tom Evans <tevans...@googlemail.com> > 2011/12/13 Germán <germanlarra...@gmail.com>: > > Has anybody solved this issu

Re: 404 only in Chrome

2011-12-09 Thread Furbee
. Furbee On Fri, Dec 9, 2011 at 5:33 PM, neridaj <neri...@gmail.com> wrote: > Hello, > > For some reason I'm getting a 404 in google chrome when I visit / > portfolio/. The url entered is /portfolio/ but it returns as a 404 at / > portfolio/undefined/ in the chrome developer

Re: Can't figure out this Object Model error...

2011-12-05 Thread Furbee
That is what I sort of assumed. You created the table with syncdb, changed the models.py for it and ran syncdb, which does nothing if the table already exists. On Mon, Dec 5, 2011 at 5:04 PM, Reinout van Rees wrote: > On 06-12-11 01:24, Marc Edwards wrote: > >>

Re: Can't figure out this Object Model error...

2011-12-05 Thread Furbee
Don't mean to sound remedial, but have you verified that the table bookmarks_eda_appcatalog exists and that it has a column named eda_app_id? Did you use manage.py syncdb to create the tables? Furbee On Mon, Dec 5, 2011 at 4:24 PM, Marc Edwards <jmarcedwa...@gmail.com> wrote: > I am

Re: Problem with Django and AJAX: Empty responsetext

2011-11-21 Thread Furbee
like a bug, but it has been too long and I can't remember exactly what the problem was. Keep me posted. Furbee On Mon, Nov 21, 2011 at 1:10 PM, Schmidtchen Schleicher < spiolli...@googlemail.com> wrote: > I'm trying to do a simple google-suggest like thing with django and ajax. > I

Re: syncdb not finding and syncing my MySQL database

2011-11-21 Thread Furbee
Yes, please offer more details. One thing I noticed off the bat, though, was that you said you are running "python manage.py syncdb" from the directory where your models.py is. The manage.py file is at the root of your project, not in the apps folder(s) where models.py is. Furbee On M

Re: ImportError: No module named django

2011-11-18 Thread Furbee
ell go to that location and enter "python setup.py install". This should install the Django framework into the Python site-packages folder, and the "import django" should work from a python shell. Cheers, Furbee On Fri, Nov 18, 2011 at 12:14 PM, Jenny <email@gmail.com>

Re: Relation not found error while dealing with foreign keys and forms

2011-11-07 Thread Furbee
for referential objects. There are not arguments I can find to forcefully tell ModelForm to use a non-default database. So, it may be that Database Routers are the only way you can get ModelForm to look for NICSGroupType in the database 'gold.' Furbee On Sun, Nov 6, 2011 at 3:04 PM, Tabitha Samuel

Re: How do I define a default (override-able) primary key field on an abstract model?

2011-11-05 Thread Furbee
I can't speak to the reference field being used as a primary key, but the initial error is that you have multiple primary keys on the single model B. If it 'is-a' class Base, it inherits id as a primary key, and also defines a and a primary key. You cannot have multiple primary key fieds, hence

Re: [Django] #17167: ModelForm model=class not honoring reference fields with secondary database

2011-11-05 Thread Furbee
No, that is incorrect. The Foreign key does not cross database boundaries. The employee table is in the secondary database, and the department table is also in the secondary database. The foreign key from from the employee table to the department table, both in the same secondary database.

Re: Relation not found error while dealing with foreign keys and forms

2011-11-05 Thread Furbee
, not FormFields. Hopefully that will get you through this jam, until a fix is created. I haven't written any patches before, but I will see if I can figure it out, time permitting. Thanks, Furbee On Fri, Nov 4, 2011 at 3:36 PM, Furbee <furbeena...@gmail.com> wrote: > No worries. Wow, I've

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Furbee
uot;/usr/lib/python2.5/site-packages/django/db/models/sql/compiler.py", line 735, in execute_sql cursor.execute(sql, params) File "/usr/lib/python2.5/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute return self.cursor.execute(query, args) Data

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Furbee
other models that don't have corresponding tables created, syncdb would create those. Furbee On Fri, Nov 4, 2011 at 11:46 AM, Tabitha Samuel <tabitha.sam...@gmail.com>wrote: > Yep, n_nics_groups and n_test_staff exist in the same 'gold' > database. > > So when I tried: > form

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Furbee
ups g ON(g.n_group_number = s.nics_group) WHERE s.username = 'tsamuel')) If that throws an error, we may have a problem in the DB layer. Thanks, Furbee On Fri, Nov 4, 2011 at 10:29 AM, Tabitha Samuel <tabitha.sam...@gmail.com>wrote: > The error that I'm getting is on the second form

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Furbee
Oh no, that would not be a good thing to share! :-) That's a bummer that the upgrade broke things. So, the error is being raised on this line? staff_form = StaffForm(request.POST, instance=staffinstance).using('gold') Furbee On Fri, Nov 4, 2011 at 8:02 AM, Tabitha Samuel <tabitha.

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Mark Furbee
page that you've tried this on, or have you just tried it in the shell? Thanks, Furbee On Fri, Nov 4, 2011 at 7:02 AM, Tabitha Samuel <tabitha.sam...@gmail.com>wrote: > Here is staff/models.py > > from django.db import models > > class NICSGroupType(models.Model)

Re: Relation not found error while dealing with foreign keys and forms

2011-11-04 Thread Furbee
Hi Tabitha, I wish I could supply a quick and simple answer to fix what's going on in your database, but nothing obvious is standing out. Can you supply your model for StaffForm? That seems to be where the problem lies, since we can get details from the model and view elsewhere. Thanks, Furbee

Re: Relation not found error while dealing with foreign keys and forms

2011-11-03 Thread Furbee
should be defined in the DATABASES section of settings.py. It looks like it is the database 'public' from your example, but double check that the 'gold' DATABASE points there. Otherwise, I wonder if it is somewhere where you are defining the form object. First, let's verify that the foreign key re

Re: Relation not found error while dealing with foreign keys and forms

2011-11-02 Thread Furbee
Can you try this and tell us what you see: Run a shell using python manage.py shell >>> instance = Staff.objects.using('gold').get(username='tsamuel') >>> str(instance.query) This will tell us whether or not the database, reference, and such are correctly translating into a query. The error

Re: Formwizard - Many2Many field - instance needs to have a primary key value before a many-to-many relationship can be used

2011-11-02 Thread Furbee
ess ? hu > > > Thanks again > > Alain > > > > On 2 nov, 20:11, Furbee <furbeena...@gmail.com> wrote: > > Hi Alain, > > > > Glad that it worked out! :-) > > > > To clarify, a blank is different from a Null, or "None" in >

Re: Formwizard - Many2Many field - instance needs to have a primary key value before a many-to-many relationship can be used

2011-11-02 Thread Furbee
e which have been already saved by Line 7 and add category. Then I > suppose Django will perform an "UPDATE" rather than an "INSERT" SQL > statement ? > > Is it right ? > > > Again, regards for the time spend to answer. > > Alain > > On 2 nov, 19:03, F

Re: QuerySet: "if obj in queryset" can be very slow

2011-11-02 Thread Furbee
Thanks Tom, that's a great explanation! Furbeenator On Wed, Nov 2, 2011 at 10:46 AM, Tom Evans wrote: > On Wed, Nov 2, 2011 at 5:30 PM, Ian Clelland wrote: > > On Wed, Nov 2, 2011 at 8:25 AM, Thomas Guettler wrote: > >> > >> #

Re: Formwizard - Many2Many field - instance needs to have a primary key value before a many-to-many relationship can be used

2011-11-02 Thread Furbee
In your Customer model there are fields which cannot be Null, so you cannot instance.save() before setting those properties. So, you may have to check for the category field in your loop and if it is category, save the instance first. Something like the following: views.py (in clients

Re: Calling Python from JavaScript

2011-11-02 Thread Furbee
You could call the Dajaxice method that gets the result (the one that fires when the drop down changes) with window.onload, or you could pass the initial values to the template via the view. For consistency and code reuse, I would personally use the first method, calling the Dajaxice function

Re: Field available via Django shell but not via web application (crossposted from StackOverFlow)

2011-11-02 Thread Furbee
You said you are using django.contrib.auth.models.User as your User model, but that doesn't have a "foos" property. Can you share the models that you are using? Are you creating a subclass User that extends django.contrib.auth.models.User and adds foos and a ForeignKey? Is foos a ManyToManyField,

Re: Onchange event on Choicefield in django formset

2011-11-02 Thread Furbee
I think your 'answer' is going to exist in POST in either case. Perhaps change the construct of your logic to: if 'evaluation' in request.POST: return render_to_response('results.html') elif 'form-0-answer' in request.POST: answer = request.POST.get('answer','')

Re: Django + Ajax/Javascript

2011-11-02 Thread Furbee
You could pass the values from the view to the template and use javascript (I would suggest using jQuery) if there are only a few options. I would suggest using Dajax (dajaxproject.com) for your AJAX commands. It is really easy to plug into Django, and you should get familiar with it and the

Re: Set of choices of which several can be chosen without using a ManyToManyField

2011-11-02 Thread Mark Furbee
As alluded to previously, the most "straightforward way to use a set of choices of which several can be chosen" IS to use a ManyToManyField. The syntax is slightly different, but ManyToManyFields are really easy to use with Django. Do not reinvent the wheel in this case. Thanks, M