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 wrote:
> Hello, I'm doing unitTesti
o require login for every page. I implemented 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/
Go
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, wrote:
> **
> @Sanders, nice answer :D, SOL
> +adesst
> --
> *From: * Thorsten Sanders
> *Sender: * django
Ha ha ha, that's funny!
On Wed, Feb 15, 2012 at 12:44 PM, James Pyrich wrote:
> On 2/15/12 1:28 PM, Dennis Lee Bieber wrote:
>
>> On Wed, 15 Feb 2012 11:45:51 -0800, Furbee
>> wrote:
>>
>> Is this posting a zombie? It doesn't seem to ever die
cause 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
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 of
He said he would do that later tonight.
Furbee
On Thu, Feb 16, 2012 at 2:04 PM, Dennis Lee Bieber wrote:
> On Thu, 16 Feb 2012 13:41:32 -0500, Scott Macri
> wrote:
>
> >I don't believe I have any circular imports in my code. I have a
> >simple file dosomethi
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 wrote:
> On Thu, 16 Feb 2012 21:00:40 -0500, Scott Macri
&g
, 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 wrote:
> I’m well into beginning build
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
wrote:
> Yes I do get it. I didn't realize that while I was ty
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 wrote:
> Hi I am pretty new to d
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
wrote:
> @Daniel
> Your __unicode__ should always return a string so like Shawn said,
> when you check your ph
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 wrote:
> Django Gurus,
>
> I'm an absolute beginner using Python in Django. I'm currently going
> through the tutorial,
view'], 'event_type': request.GET['event_type'],
'filterValue':
request.GET['_filterValue']}, context_instance=RequestContext(request))
>From the template, now, the different variables are available. {{ date_time
}}, {{ submit_preview }}, {{ event_type }}, {{
luck,
Furbee
On Tue, Mar 13, 2012 at 11:57 AM, Larry Martell wrote:
> On Tue, Mar 13, 2012 at 12:38 PM, Furbee wrote:
> > I think you want to actually get these in the view code and pass them to
> the
> > template as named variables. For example:
> >
> > retur
get updated details.
Cheers
On Tue, Mar 13, 2012 at 2:23 PM, Larry Martell wrote:
> On Tue, Mar 13, 2012 at 2:19 PM, Furbee wrote:
> > Hi Larry,
> >
> > render_to_response is one of many ways to return an HttpResponse to send
> to
> > the client. Wherever your view
13, 2012 at 3:33 PM, Furbee 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 that was requested. Once the page is sent to the client,
> Django
012 at 3:53 PM, Furbee 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 when you want to use javascript to update the URL
> >
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 wrote:
> Aha! Very nice. As a sidebar, you said you pass the filter string back to
> the templ
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 wrote:
> On Tue, Mar 13, 2012 at 4:26 PM, Furbee wrote:
> > Oh, you are filtering in the
>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 in
o see that there was an exception,
instead of them 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 wrote:
> On Fri, May 4, 2012 at 4:06 PM, doniyor
> wrote:
> > if i call the dajaxice.cor
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,
run python
manage.py syncdb to have it recreated including this field.
Furbee
On Tue, May 15, 2012 at 8:57 AM, Gethin Llyn ab Alwyn wrote:
> Hello all!
>
> I'm following James Bennett's book Practical Django Projects, and I've got
> stuck at page 65 Chapter 4. On that page, ther
data.
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 wrote:
> Thank you for your answer, deleting the table and running manage.py syncdb
> did the trick
>
w 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 wrote:
> > right, I was being very brief in my description!
> > But it is the followi
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
jQuery
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','')
val
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, O
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 respo
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 application)
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:
> >>
> >> # This is my current solution
> >> if get_special_objects().filter(p
those 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,
quot;instance.id == Non" and it seems to be
> faster.
>
> To be sure. You mean that if a customer has 1 category, there will be
> 2 database access (one for all informations except category and one
> for category).
>
> If a customer has 50 categories, then it's 51 databa
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 means
s this operational for your instance? If not, I would double check that
the n_nics_groups table definitely exists in the datasource you defined as
'gold.' This should be defined in the DATABASES section of settings.py. It
looks like it is the database 'public' from your
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,
F
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 wrote
roups 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 wrote:
> The error that I'm getting is on the second form instantiation, tha
have 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 wrote:
> Yep, n_nics_groups and n_test_staff exist in the same 'gold'
> database.
>
> So when I tried:
> form = StaffForm(i
kages/django/db/models/sql/compiler.py",
line 680, in results_iter
for rows in self.execute_sql(MULTI):
File "/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-p
they would just be a goup, 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 wrote:
> No worries. Wow
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.
Furbeen
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
"ta
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 Sa
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 wrote:
> I am as newbie
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
hough it seemed 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 dja
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 wrote:
> I am receiving the following er
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:
>
>> DatabaseError at/admin/bookmarks/e
lio/?my_hax_rock, etc. See if that helps.
Furbee
On Fri, Dec 9, 2011 at 5:33 PM, neridaj 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 t
/ascii-value-of-a-character-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
> 2011/12/13 Germán :
> > Has anybody solved this issue?
> >
> > On Dec 14 20
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
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 wrote:
> Never mind, found the answer:
>
> http://efreedom.com/Question/1-806835/Django-Redirect-Previous-Pag
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 wrote:
> I've got a project where when I pull up the admin pag
. 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 wrote:
>
> On Jan 11, 9:23 pm, Dennis Lee Bieber wrote:
> > On Wed, 11 Jan 2012 17:26:44 +, Tom Evans
> > wrot
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 unsubscribe from this group and stop
generated and how long it took to get 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 wrote:
> "with large of records in A and B, the above takes lot of time"
>
> How long? At f
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
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 tow
, 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 wrote:
>
>> Denis Darii already answered this on February 1st:
>>
>> "You can redefine
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,
Mark F
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 wrote:
> Here is staff/models.py
>
> from django.db import models
>
> class NICSGroupType(models.Model):
>n_group_number = models.I
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
> >
> > @login_required decorator
working! Any help?
>
> On Jan 17, 10:37 pm, Mark Furbee 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.
> > Chicken and egg.
gged
out successfully.'}, context_instance=RequestContext(request))
template login.htm:
.
.
.
{% csrf_token %}
Login
{% if error %}
{% FatalImage %}
{{ error }}
{% endif %}
{% if warning %}
{% WarnImage %}
{{ warning }}
{% endif %}
{% if notice %}
{% NoticeImage %}
{{
slashes, change the ? with *, like
`url(r'^login/*', 'views.Login')`. Again, that's not tested, but it should
work, I think.
Happy Coding!
Mark
On Wed, Jan 18, 2012 at 6:09 PM, coded kid wrote:
> Thanks bro. Don't you think I should import Login in urls.py? What
>
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 y
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 should be
>> part of the strin
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
htm
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 you
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:
> https://www.djangoproject.com/weblog/201
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 wrote:
> I have tried
Can you run manage.py shell and connect to 'views?'
On Thu, Apr 4, 2013 at 4:13 PM, Mark Furbee 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
> Python, perhaps? Is the
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:
>
> I have this models
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:
> Ok, I read that, but
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
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 "Pedido" model, not "It
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 rec
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 wrote:
> Yes, that link will cov
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 menu contrast is
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,
82 matches
Mail list logo