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
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
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
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,
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
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
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,
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
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
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:
>
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:
>
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
>
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
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:
>
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
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
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
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
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
.
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
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
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
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
>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
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.
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
;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
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
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
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
'],
'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
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
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
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
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
, 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:
>
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
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
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
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
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
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
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:
>>
>
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
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:
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
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):
> > "&
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
, 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.
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
> >
> >
. 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
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
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
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
-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
.
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
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:
>
>>
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
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
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
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>
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
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
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.
, 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
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
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
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
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.
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)
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
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
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
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
>
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
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:
> >>
> >> #
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
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
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,
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','')
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
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
82 matches
Mail list logo