I have close to 600 users split by 20 or so offices. We have a
helpdesk form (using ModelForm) which displays an initial user list
based on the office, or no users if an office is not selected.
An AJAX function on the front end dynamically changes users in the
drop-down based on the office selecti
Thanks Malcolm - getattr() is the one I knew had to be there but
couldn't remember or find it anywhere. And I'm pretty sure I've even
used it before. sheesh.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django use
Most of the errors I'm seeing these days in my application are of the
"NoneType object has no attribute" variety. While this may be
helpful on occasion on the development server, I really don't want it
creeping up on production.
"Well fix them!" you say. Actually there is nothing to fix. This
Thanks for the responses - shortly after posting I realized what I
missed for a successful test of the caching software. After adding the
proper lines to 'MIDDLEWARE_CLASSES', memcached came to life.
If anyone is curious, before memcached the test page was getting about
10 trans/sec. After memcac
I have a test server which is running the db and django app (apache/
mod_python). Before moving to production, I'm running stress tests and
optimizing performance. My plan is to optimize on the test box, see
what works, then implement these on production which is separate db
and app servers.
Here
well, doy. I just noticed that when attempting to create a form from a
model I called forms.Form instead of ModelForm. I'll mess with it some
more and see what happens.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Thanks Karen, that fixes the problem in the django admin. At least now
I know that everything is ok on the database and model fronts.
However, in my own form it is still not validating this relationship.
Here is what I have right now:
in a forms.py file there is a base form for the Case model:
-
Could this be a problem with the editable=False setting?
The record I am attempting to duplicate is a duplicate office/county/
case_no entry. However, it is also a duplicate county/case_no. It
seems like even with the form validation ignoring 'office' it would
catch the county/case_no dupe?
I tr
This is from the 500 error:
--
IntegrityError at /case_edit/2651074/
duplicate key violates unique constraint
"case_no_office_county_unique"
--
I'm using the latest SVN build (9692).
This is what I used to create the constraint (since this was added
long after the table was created from django):
I have 3 fields that need to be unique together: office, county and
case_no. In the "Case" model, I have the following:
--
class Case(models.Model):
office = models.ForeignKey(Office, editable=False)
county = models.ForeignKey(County)
case_no = models.CharField(max_length=20)
...
class
Thanks Karen - I think that got it. At least it's looking better than
it has been. Apparently the missing field from 'cleaned_data' was
caused by the wonky way I had it set up before.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
-- Update --
If I make the clean method for 'county', it works. I guess county
comes after case_no so both are accessible by that time. Weird, but I
can deal with it. However, that brings me to the 2nd issue with this
process: Whatever is accessed in the clean method is no longer
accessible for w
I have 2 fields I'm working with in a custom clean method:
- case_no
- county
the clean method is for case_no, so I have this:
--
def clean_case_no(self):
d = self.cleaned_data
form_case_no = d['case_no']
form_county = d['county']
...
--
The form fails with KeyError on 'county'. How else
It's back!
No error on dev server, but crashing like crazy on test with same old
crap:
>> Caught an exception while rendering: Reverse for '> 0x2ae96d979410>' with arguments '()' and keyword arguments '{}' not found
It alternates between that and:
>> Caught an exception while rendering: No modul
Did you delete the .pyc files from the django source? Another approach
would be to go into /django/contrib/ and delete the comments
directory, then do an 'svn up' to restore it. Then you'll be sure to
get a fresh copy.
That is what worked for me. But if you haven't used the comment system
before
Well it happened again when I uploaded the comment changes to another
server.
Here's the fix: go to /django/contrib/comments and wipe out the .pyc
files:
sudo rm */*.pyc
that finally fixed it.
On Aug 26, 11:37 am, hotani <[EMAIL PROTECTED]> wrote:
> This ended up working (I
Fixed after poking around a bit. I found that by sending "user_id" in
a hidden field, the comment system is able to figure out who it is.
On Aug 26, 12:49 pm, hotani <[EMAIL PROTECTED]> wrote:
> What is the best way to do this? It is not included in the new docs,
>
What is the best way to do this? It is not included in the new docs,
and the default form elements include required fields for name and e-
mail address. Obviously if the user is logged in we don't need this.
Before I go hacking the form to shreds, I wanted to see if someone had
a better idea. May
re showing up now and not exploding.
On Aug 26, 11:21 am, hotani <[EMAIL PROTECTED]> wrote:
> No idea. I seem to be getting the same thing.
>
> The comments upgrade has caused all kinds of meltdowns in my
> applications. For one, updating the SQL failed. PostgreSQL was
> com
No idea. I seem to be getting the same thing.
The comments upgrade has caused all kinds of meltdowns in my
applications. For one, updating the SQL failed. PostgreSQL was
complaining because it was updating fields set to "NOT NULL" with null
values. I changed the query to accommodate for this, now
Thanks Malcolm--reading now.
One fix to my post - I'm using svn 8444. Was in the wrong project when
i checked.
On Aug 19, 3:26 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2008-08-19 at 14:22 -0700, hotani wrote:
> > I'm using svn 2204, and "s
I'm using svn 2204, and "save_FOO_file" does not seem to exist any
more. Nor is it in the documentation anywhere that I've been able to
find. Is someone successfully using this on a recent build?
More importantly, if save_FOO_file no longer exists, what takes its
place?
Here is an example of wha
I had a form that was working with oldforms generic and had some
hidden fields. After the newforms-admin merge and newforms-generic,
the hidden fields are being passed as NULL. In
'BackwardsIncompatibleChanges,' it says "You'll probably need to
update any templates used by these views."
So what e
Since loading the most recent updates from svn, the one piece that is
broken for me is where I had a datetime field split into two on a form
using generic update.
I had basically copied the method from the old admin area which used
oldforms. For a datetime field called "date," the date field woul
I changed the query from an "inner join" to "left outer join" which
returned issues with null resolutions.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to dja
In a helpdesk app, I have a model called 'issue' which has a foreign
key called 'resolution'. The 'resolution' model allows null values -
if an issue is open, 'resolution' will be null, if closed, there will
be a value there.
Before queryset-refactor, I could do the following and get results
sort
This fixed it!
http://peeved.org/blog/2007/11/20/
By adding this line after 'import ldap', I was able to search from the
root level without specifying an OU:
ldap.set_option(ldap.OPT_REFERRALS, 0)
--~--~-~--~~~---~--~~
You received this message because you are subs
Right - sorry. I mistyped that. It is correct in my code and reads:
DC=server, DC=local.
So this works: 'OU=some office, DC=server, DC=local'
this does not: 'DC=server, DC=local', nor does this:
'OU=,DC=server,DC=local', nor does any wildcard character I've tried
so far.
This is the error return
I am attempting to pull info from an LDAP server (Active Directory),
but cannot specify an OU. In other words, I need to search users in
all OU's, not a specific one.
Here is what works:
con = ldap.initialize("ldap://server.local";)
con.simple_bind_s('[EMAIL PROTECTED]', pass)
result = con.searc
That's one helluva drop-down.
On Mar 21, 8:29 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Thu, Mar 20, 2008 at 12:12 PM, hotani <[EMAIL PROTECTED]> wrote:
>
> > My issue is similar to this one from October:
>
> >http://groups.google.com/group/django-
First off, this is only working at all because one app is using free
comments while the other is using the standard non-free comment
system. Which means they can use separate templates (free_preview.html
vs preview.html). This is all great until I come to the common
template, 'posted.html'.
Witho
I am attempting to avoid writing a custom admin page. There are at
most two people that will be updating the database, and this seems
like a great job for the django admin area.
However, for this to work I need a way to update a 2nd model (a
history table) when another model is updated. Is this p
Ah nice. That will do the trick. Thanks!
--~--~-~--~~~---~--~~
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
I have 'drop-down A' which, when changed, updates 'drop-down B' via an
AJAX call.
Problem is this: ChoicesField for drop-down B won't recognize any of
the choices and I can't submit the form. Is there a way to turn off
that piece of the validation?
Alternatively I could remove 'drop-down B' from
I have considered it, but the first project is rather large and we
wanted to keep it on its own server with a separate database. I am
still at the high level design stage of the second project so it may
end up bundled with the first.
--~--~-~--~~~---~--~~
You rece
I'm about to build a new project using django that will have the same
users as a previous project. I would like to avoid duplicating the
existing user table. Is there a way to authenticate into the new
project with the current user list?
--~--~-~--~~~---~--~~
You
Thanks. It is on a dev server so no biggie. I changed the models to
DecimalFields and all is well.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us
Full error:
[__init__() got an unexpected keyword argument 'max_digits']
Just updated from svn today and when I tried a syncdb that is what
happened. Is 'max_digits' not allowed anymore?
Here is an example straight from the model:
fine = models.FloatField(max_digits=9, decimal_places=2, blank=Tr
Thanks for the comments. I'll post back tomorrow with the python
script I was using that worked (somehow?) for matching the hyphen with
a '\w+'. I'll also try these suggestions and post back the results.
--~--~-~--~~~---~--~~
You received this message because you
Having issues matching a hyphen character in my urls file. Here is an
example of what needs to be passed: "12-34-56".
In python, the "\w+" matches this, but django urls will not. I have
also tried (from another post in this forum) "\[-w]+" which did not
match it either. The only way I have been a
Just ignore me. I like to overlook obvious bits then wonder why it
isn't working. I was using "editable=False" in several of the fields I
wanted to hide, but missed one. So the "editable=False" solution *is*
the fix I was looking for, I just gooned it up by missing a field. :-)
--~--~-~-
What is the best practice for handling this?
Let's say I have a form with 3 fields:
name, b-day, status
I want a form that will allow the user to edit "name" and "b-day",
then keep "status" whatever it was before the edit. Should I send this
through as a hidden field?
Of course, I'm talking abo
I found in another message this fix:
in the model, I changed to:
models.ForeignKey(Client,raw_id_admin=True)
Filing this in the "gotcha's" category. gr.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Dja
I should add that I ruled out the template by commenting out the
entire page. It still took a minute or more to load.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send
Here is the basic model setup:
--
class Client(models.Model):
fname= models.CharField(maxlength=30)
mname= models.CharField(maxlength=30, blank=True, null=True)
lname= models.CharField(maxlength=30)
[...and more details, but you get the point...]
class
I've done this with a massive database. It wasn't pretty, but is
possible.
Here are my very brief notes on the conversion. I used phpMyAdmin to
export the data, and the postgresql module in Webmin or phpPgAdmin.
Webmin became necessary for large tables as phpPgAdmin would fail/
timeout or whateve
I was having the same problem with {{ object_list.count }}, but from
the first link above found that {{ object_list|length }} does the
trick.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To
Never mind, I think I figured this out. There were some duplicate rows
in the imported data which was probably causing the error. The old
system let a couple slip through and now I have to clean up.
--~--~-~--~~~---~--~~
You received this message because you are s
I'm moving data from another database and when I try to populate the
relational table created by django as a result of a ManyToMany field,
I run into a unique constraint error:
duplicate key violates unique constraint
"main_msgpost_users_msgpost_id_key"
msgpost_users is
Very nice!
This works:
div_list =
Division.objects.filter(county__activecounties__active=True,county__activecounties__office=office,active=True)
Although I am glad to have my manual query function working (I'm sure
I'll need it later), it is really nice to know django can handle the
relationship
Thanks, I'll give that a shot. I did try something similar but it did
not work for some reason.
The active column in the activeOffices model is there because some
relationships exist but are inactive. For example, I could have a
county that used to be under a certain office, but is no longer. In
After digging through the messages here, I finally just did a custom
query. Here is the function I used that will spit out a template-ready
dictionary:
---
def csql(self,query,qkeys):
from django.db import connection
cursor = connection.cursor()
cursor.execute(query)
r
This is the table (model) setup:
[county] (list of counties)
[office] (list of offices)
[active counties] (a relational table with a county_id, office_id and
'active' column)
[division] (columns: 'name', 'county_id' which points to the first
county table)
Obviously the division table is directly
Thanks, that example for extending the generic view is what I was
looking for; I'll try it out tomorrow.
As for request.user not being available, that was when I was trying to
use it in urls.py. I have never had a problem accessing it from views.
--~--~-~--~~~---~--~
I have a generic view for an object in a basic bug tracker app. It
shows things like 'title', 'description', 'resolution', etc.. and that
is all working fine with a generic view.
However, I'm trying to send a piece of info that involves a completely
different model and not finding a pleasant way
Thanks for the comments - I think I get it now...
I have a file context_processors.py where I added the function, then
the line in settings.py for TEMPLATE_CONTEXT_PROCESSORS, and all seems
to be working now. I was trying to make this fit into my previously
ingrained idea of using cookies to pass
This has been asked several times, but I am not clear on how people
are solving it. From what I understand so far, a setting called
"TEMPLATE_CONTEXT_PROCESSORS" can be tweaked to make this possible.
However, I'm not seeing a clear way to do that.
I have a user setting which needs to be available
Ahhh, yes. That is it. Thanks!
Chalk up another one on the stupid mistakes board!
--~--~-~--~~~---~--~~
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@googleg
BTW, it works fine--so I suppose this is a 'feature'. My users,
however, may become concerned when they see the long line of *** in
the fields. And as many of you know... when the users are concerned,
we are concerned. :-/
--~--~-~--~~~---~--~~
You received thi
this is what I am using:
password = forms.CharField(widget=forms.PasswordInput,
label="Password")
even when the password is 4 characters, the '*'s fill the text field.
How can I get this to accurately represent the number of characters in
the password?
I tried max_length, but it filled up to
BING! Fred's fix did it. Notice in the package lists above I had
"Django-0.95-py2.4.egg"? There was also a symlink for django in there.
I removed the .egg, reloaded the server and all was well. Thanks
everyone!
On Jan 23, 2:48 pm, "Fred" <[EMAIL PROTECTED]> wrote:
> Are you sure you don't have
I'm running thru apache--perhaps that is the root of my issues? I will
check the egg file and see what I can find.
When I do run the dev server it reports 0.96-pre.
On Jan 23, 2:42 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> When you start your development server (python2.4 manage.py
x27;C:\\Python24\\lib\\plat-win',
> 'C:\\Python24\\lib\\lib-tk',
> 'C:\\Python24',
> 'C:\\Python24\\lib\\site-packages',
> 'C:\\Python24\\lib\\site-packages\\PIL',
> 'C:\\Python24\\lib\\site-packages\\win32',
> 'C:
I just tried removing the 'django_src/django' directory, followed by an
update and am still not seeing the new stuff. :-(
On Jan 23, 1:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I've had similar problems with .pyc files not getting cleaned out, etc.
> The easiest way to fix this is
one python installed?
>
> On Jan 23, 8:36 pm, "hotani" <[EMAIL PROTECTED]> wrote:
>
> > I'm missing something here. It seems like I'm not really updating
> > anything. The new {# comment #} tags still don't work, and when I just
> > tried to
I'm missing something here. It seems like I'm not really updating
anything. The new {# comment #} tags still don't work, and when I just
tried to add in the line for testing newforms it bombed out on me.
This is the line atop my view:
from django import newforms as forms
That was copied straight
This is a strange gremlin I have found, and am completely stumped.
The form:
A list view with filters which are in the form of drop-downs. A filter
is set in the session, and removed when the user selects "all ___" in
the drop-down. Basic stuff, right?
One drop-down works, the other does not:
t
One more thing: If I do what it says, and send it the user in the form
of a class, it will continue, but after running "newprofile.save()",
nothing is written to the db table.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Googl
I'm using the 'one to one' method of creating a user profile which
extends django's built-in user model. This is a workaround suggested by
James Bennett on his b-list blog, and I think several other people are
using this or something similar.
My problem is that I have a database I am importing. I
I noticed in the most recent documentation that we should now be able
to use the {# comment #} multi-line commenting tags in templates.
However, after doing an 'svn update' and restarting apache it does not
seem to be available. Which begs the question: am I not fully updating?
Is there something
Small correction:
The completed example should be as follows (with parens around 'OR'
lookup):
--
Q(res__isnull='on') &
(Q(desc__icontains='bla') | Q(title__icontains='bla'))
--
--~--~-~--~~~---~--~~
You received this message because you are s
Fixed!
Just changed commas to '&' - the queries work the same, and eval
doesn't try to turn the string into a tuple.
Staring at the docs for a while works wonders...
I changed this:
-
Q(res__isnull='on'), Q(desc__icontains='bla') |
Q(title__icontains='bla')
To this:
-
I'm building a custom set of filters, and since I need to do 'OR'
searches it is assembling them as a string that could look like this:
-
filter_string = "Q(resolution__isnull='on'),
Q(description__icontains='a') | Q(title__icontains='a')"
-
My problem is getting this from the string I've
thanks, right - that was obvious and I overlooked it, not my first
time...
--~--~-~--~~~---~--~~
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
I'm trying to display the most recently closed bugs in a bug tracker by
using the archive_index generic view, but no matter what, it will not
return any results.
this is from urls:
recent_dict = {
'template_name': 'recent.html',
'date_field': 'last_mod',
'num_latest': '20'
Thanks for all the responses. I fixed it in the view by altering my
nice generic block of code... oh well. Here is the result:
if filter_fields[f] == 'pfilter':
request.session[filter_fields[f]] =
int(request.POST[filter_fields[f]])
else:
request.session[filter_fields[f]] = request.POST[f
problem on the view side is that the function setting the cookies
doesn't just deal with strings or ints. If I get into customizing for
each item I sent in, it defeats the purpose.
I wrote a custom filter that would change the values to ints, and it
works - but it will not work inside the {% ifeq
yeah, python can do it, but where do I put this? Forgive my n00b
question but would this go in the view?
The session var is set by looking at post data, I'm guessing this is
the one that is a string now rather than 'project.id' - Seriously, am I
doing something strange here? Maybe there is a buil
Thanks for the replies.
However, after digging through the documentation I'm not seeing
anything that will convert my strings to ints or vice versa. Where is
this filter I am overlooking?
--~--~-~--~~~---~--~~
You received this message because you are subscribed
Code:
{% if request.session.pfilter %}
{% ifequal request.session.pfilter project.id %}
{{ project }}
both {{ project.id }} and {{ request.session.pfilter }} return "1"
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
I'm doing a comparison of a session variable and an id for a 'selected'
tag in a drop-down in a template. If I output both vars, they will both
be "1" yet 'ifequal' is still returning false. Has water stopped being
wet?
--~--~-~--~~~---~--~~
You received this mess
nice - this worked for my hidden field update as well. Thanks!
--~--~-~--~~~---~--~~
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
Can you get it to show up in the admin area? I've had to reverse
engineer several things by digging through the admin area code and
applying it to my own stuff.
I'm having a similar problem with a date field, I'm just trying to
update a date with a hidden field and nothing seems to work. It just
Ok, let me throw out some more info This seems REALLY BASIC, and
yet I've spent an embarrassing amount of time trying to figure it out.
Unfortunately this has been happening a lot with Django. I'm having
problems finding out how to do things I just took for granted with php
or cf.
Let's say I
I'm using a generic view for a form and have a few drop-downs on the
page. However, I don't want to display every item in the drop-down. I
thought I would put in an "active" switch on them, but can't figure out
how to only show the active items on the template.
would this be A: a filter set up in
I got it finally...
changed this:
return render_to_response('main/index.html')
to this:
return render_to_response('main/index.html',
RequestContext(request, {'request': request}))
and that took care of it. Only took a few hours of staring at the
generic views code and plenty of trial an
this is what I'm sending out in the view. Basically this is an empty
section of the site that will be created later. However, it bothers me
that the menus and such will not work correctly since it seems I'm not
passing the correct info.
from views.py:
def index(request):
return render_to_
I think I'm missing something in my own views. Everything created by
django (admin area, generic views) will get the user info, but when I
do a view myself it doesn't work. What little tid-bit am I missing here?
--~--~-~--~~~---~--~~
You received this message beca
I am having this problem as well, but only for part of my site. The
admin area works normally, one of my apps works well, but another app
(happens to be the one at '/') does not see the user. {{ user.username
}} returns "". It sees someone logged in, so user.is_anonymous is
false, but everything a
well that did it. I deleted settings.pyc, then ran 'syncdb' and
restarted the webserver. Seemed like a lot to go through for a little
change!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To
I've restarted the webserver but I'm still getting the debug 404
messages, plus at the bottom it says "You are seeing this because you
have Debug=True in your settings file" when I'm pretty sure I changed
that. Is there something else that needs to be restarted? A cache to be
cleared? Anything?
I'm on another machine without my code readily available - so let me
attempt to rephrase one of the problems i'm having with generic
updates:
if there is a model with 10 fields, and an existing object which I'm
editing in a generic view, but only editing 2 of the 10 fields, it is
attempting to re
According to the docs, this should return a dictionary:
model.objects.filter(id=5).values()
However, none of the normal dictionary methods work on it, like say
"keys()."
Basically I'd like to grab an entire object and convert it to a
dictionary so I can work with it, is this possible?
--~--~-
I'm pretty much giving up on this -- unless i find an alternative, I'm
going to end up using hidden fields with the generic update view. I
know this is far from ideal, but I can't get anything else to work.
Basically this is a bug tracker - kind of a get-my-feet-wet app to test
out Django. In ord
My form text fields are auto-filling as they should, but drop-downs are
not. If I use a generic view they work fine - but when I do that I
can't control the fields hidden from the user.
I'm trying to do this with a custom view and manipulators but have had
nothing but trouble. Why is it so diffic
95 matches
Mail list logo