I'm trying to construct a query which combines two filters on a
related model, and I'm having no luck. Hopefully somebody can see what
I'm doing wrong, and point me in the right direction.
I'd like to be able to specify two exclude criteria on a related
model, and have both criteria apply to the
On Jul 10, 12:37 pm, Ben Kreeger wrote:
> How do I go about accessing that data from P2's database? Do I need to
> create a model in P1 and bind it to a certain table in P2's database?
> If that's the case, how do I specify access credentials for that
> database? Is that in settings.py?
If the t
On Jul 13, 8:48 am, Frédéric Hébert wrote:
> When I declare the outter view after the inner in urls.py she's never
> been called. It's the inner that's got it.
> (She's called when I reverse the order of declaration, eg the outter
> first)
>
> I've pasted the code at dpaste :http://dpaste.com/
On Jul 13, 10:03 am, itodd wrote:
> Greetings,
>
> I'm trying to use a SelectMultiple with a set of static choices. I'm
> experiencing odd behavior when the number of choices exceeds 10. For
> example, take the following Model and ModelForm:
>
> class Project(models.Model):
> RECIPIENTS = (
On Jul 14, 8:23 am, Benjamin Kreeger
wrote:
> I was using PostgreSQL at first, but then I found information about
> reading data across databases only with MySQL, so I'm using MySQL for
> the time being.
>
> Now, I don't have a database set for P1 yet because it's just
> displaying reStructured
further than the line above
it? That would certainly cause a python syntax error.
Regards,
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to t
t least one space between the value and the "/" character.
Something like this:
would be valid XHTML. If you don't care at all about XML conformance,
you could also just get rid of the "/" and have
which is valid HTML, but not XHTML.
Regards,
Ian Clelland
<[EMAIL P
ur own views, then you may be using plain Context objects,
and your context processors won't be executed at all.
--
Regards,
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
&qu
isting database (not
that I've actually tried this).
Basically, you can use the admin tool to create the models.py file
from an existing database, rather than doing it the other way around.
Check out the documentation at
http://www.djangoproject.com/documentation/legacy_databases/ for a
star
e in
vim, when you are using it interactively. It is not required in a
.vimrc file.
--
Regards,
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
On 8/1/06, toth anna <[EMAIL PROTECTED]> wrote:
> What are you using for editing sources?
If you're a native vim speaker, I have a version compiled for OSX,
using the native Aqua interface, off of my homepage here:
http://ian.casa.cavewallarts.com/vim.html
Ian Clelland
<
y use for models and fields?
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~~
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
{% else %}
Not today's poll
{% endif %}
On a list page, you are probably already iterating over the
"object_list" variable -- you should be able to access the
was_published_today method in a similar manner, for each element of
that set.
Ian Clelland
<[EMAIL PROTECTED]>
--
an
instance of A -- although you could certainly make it do that.
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send ema
import app1.views. Error was: No module
> named utils.strings
If you want to be able to import files like this, you will need a file
in the utils directory called __init__.py. You can leave the file
empty, but it has to be there for python to recognise the directory as
a package.
Reg
ith a patch to address this problem
( http://code.djangoproject.com/ticket/2534 ). If this patch is
applied to the django source, then your models will work as you expect
them to.
--
Regards,
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~~
You received th
at Apache is running under (www-data on my Debian
systems, for example). Double-check the directory ownerships and
permissions, and see if you can get it to work with a FileField in a
simple model.
Regards,
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~
ally, our PhotoField class also supports thumbnail generation,
although we generate them dynamically, rather than saving them at
upload time.
Regards,
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~~
You received this message because you are subscribed
re probably better off leaving them
in a media directory, and letting Apache handle them, and just live
with the URL bar showing the real location.
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
its fields, and the exact structure of your urls.py
file.
--
Regards,
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
oid having to tinker with the backend
source, is to override the get_internal_type method of my custom
fields. By default, it returns the name of the class it is called
from, but you can override that to return the string "ImageField" and
the database table will be created correctly.
d when the user is deleted, you could alter the ticket table in
your database. Just make sure that the user_id column explicitly says
"on delete cascade", and the database will take care of deleting
tickets automatically.
Regards,
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~
the value is stored in the database. (Override the
get_internal_type method to return "IntegerField" at the very least)
Regards,
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Gro
Getting more off-topic by the minute,
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~~
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@googlegr
nt, like assign the tickets to
another user, you will have to write a custom view (and possibly a
custom manipulator) to do this. In that case, you would not want to
delete users using the built-in admin interface at all, but use your
custom view instead.
Regards,
Ian Clelland
<[EMAIL PROTECTED]
t the code involved, I'm not sure why
you'd be getting an error, but you should be okay if you leave the
validation out.
ImageFields automatically have isValidImage added to their validator
list when the upload form is processed, so you don't need to specify
it expli
ll have to do it all in python, rather than sql, but you'll at
least have the full power of django's orm :)
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django
l from the field that I'm just missing? Or
is this this really the easiest way to do this?
Regards,
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users&quo
t; line if there's
nothing else in the class. That should be enough to get model into the
admin screens.
Regards,
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
the admin index uses the verbose_name_plural attribute,
rather than verbose_name.
Bryan's right, you don't generally have to specify verbose_name, if
it's the same as your class name, but until version 2593, you had to
specify verbose_name_plural.
Update your local copy of m-r, and it should w
last week for both ways of doing this:
http://groups.google.com/group/django-users/browse_thread/thread/93c024f1523f5323/6bea5b407797e597
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to th
in Python 2.4:
>>> g = (x**2 for x in range(10))
>>> g
>>> g.next()
0
>>> g.next()
1
>>> g.next()
4
Check out http://www.python.org/dev/peps/pep-0289/ (Generator Expressions)
--
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~--
that and it should work.
Regards,
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~---~--~~
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.
you have
constructed yourself would be to have a template loader which searched
some sort of dictionary of previously-build template objects, but I
don't think that's available in django right now.
I'd love to be proven wrong, however. That would come
ld save other implementers some time.
Well, this thread likely won't stay active on the mailing list for
very long; you should look at creating a node on the Django cookbook
(at http://code.djangoproject.com/wiki/CookBook) with some sample
code.
Reg
r is just to pass. The save method has
to take the fields from the new_data dictionary, assign them to fields
in the original object, and call original.save().
Alternately, I think you could subclass yourmodel.ChangeManipulator,
and override the methods in there that you need to change, but I'v
ect_key)
original = manipulator.original
if request.POST:
# code here exactly like for AddManipulator
else:
errors = {}
new_data = original.__dict__
# generate and present form just like AddManipulator
Regards,
Ian Clelland
<[EMAIL PROTECTED]>
--~--~-~--~~~--
ubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
--
Regards,
Ian Clelland
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send emai
to upgrade. Django 1.3 is almost a year old,
and is still the current version -- if you can wait a couple of weeks,
you'll see 1.4 released as well.
> With the commas missing, all requests to nonexistent URLs returned a
> 500 error.
>
>
> On Feb 22, 12:31 am, Ian Clelland wrote:
t; To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com 'django-users%2bunsubscr...@googlegroups.com');>.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
--
Regards,
Ian Clelland
--
You received this
t;
> --
> 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 'django-users@googlegroups.com');>
> .
> To unsubscribe from this group, se
our INSTALLED_APPS setting contain the apps that should be translated?
--
Regards,
Ian Clelland
--
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
On Monday, April 2, 2012, Ali Mesdaq wrote:
> I did have UTF-8 in the db before but then when I was inserting(done by a
> script) values in I would get errors. I really want to avoid doing
> conversions before I insert the data so I can maintain the data in the
> exact format as it was seen in.
jangoproject.com/ticket/16494, and
you can see the changes that were made for 1.4 here:
https://code.djangoproject.com/changeset/16829)
--
Regards,
Ian Clelland
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group,
come back here with some code that you've tried and
hopefully we can find a solution
Ian
> i tried decoding the value as
>
> val.decode('utf-8')
>
> ...this helped to reduce a few encodings but gets stuck for
> the encoding "\xa0"
> Please HELP!
>
ooglegroups.com');>
> .
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com 'django-users%2bunsubscr...@googlegroups.com');>.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
t;
No, if you have the CSRFViewMiddleware installed, then you don't need this
line at all.
--
Regards,
Ian Clelland
--
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@googlegro
tally, I'm sure): once as the first argument, and again as
a named parameter.
If the argument "_('name')" is supposed to be the field label, then you
should pass it explicitly as that keyword art, like this:
name = forms.CharField(label=_('name'), max_length=1
end email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
--
Regards,
Ian Clelland
--
You received this m
should never
deliberately be creating 500 errors. The only responsible thing to do when
a 500 is seen in the logs is to track down the source of it and fix the bug.
--
Regards,
Ian Clelland
>
--
Regards,
Ian Clelland
--
You received this message because you are subscribed to the
this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/EXpvuuttJ64J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, v
send email to
> > django-users@googlegroups.com
> .
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com .
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
>
> --
f another object, then just use
that!
Try something like
fi = request.user.get_profile().financial_institution
txn = Transaction.objects.extra(
where=['(tpin=%s or teller_no=%s or identifier=%s) AND
financial_institution_id=%s'],
params=[value, str(value), value, fi.id])
--
))
)) | (
Q(dob_year_max=alive_y2+1) & (
Q(dob_month=1) & (
Q(dob_day=None) |
Q(dob_day__lt=1)
))
))
--
Regards,
Ian Clelland
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To p
;, and you can
see the engine used by all of your tables.
--
Regards,
Ian Clelland
--
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
g, even though they are rarely
encountered.
320 characters suffices for any valid email address.
--
Regards,
Ian Clelland
--
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@go
# yes, it is special
I believe that in some cases, the exists() query can be optimized to return
faster than a count() aggregation, and I think that the intent of the code
appears more clearly.
Ian
--
Regards,
Ian Clelland
--
You received this message because you are subscribed to the Goog
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(pk=obj.pk).c
ated, or you might end up with 70M objects, or anywhere in between.
Again: odd, undocumented, and potentially surprising behaviour, and I'd
recommend explicit over implicit, especially in this case.
--
Regards,
Ian Clelland
--
You received this message because you are subscribed
>
> Zak
>
> --
> 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 email to
> django-users+unsubscr
on out of CSRF protection, then you
can do that too -- it's not baked into Django that deeply. You will need to
change your settings, and remove the CSRF middleware from
MIDDLEWARE_CLASSES. That will completely remove this feature from your
project. (and, of course, remove all of the security benef
ttings.DEFAULT_FROM_EMAIL[settings.CONTACT_EMAIL_TO]"
looks like you're trying to use a string to index into another string
variable.
Ian
--
Regards,
Ian Clelland
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post t
ing the tutorial for the development
version. (There used to be a big warning about this at the top of all every
page in the development docs, but it seems to have disappeared.)
Try following the tutorial starting at
https://docs.djangoproject.com/en/1.3/intro/tutorial01/
instead, and see how far you
u 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 email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.co
;
Yes, yes and yes.
If you have console access, you can also do this:
manage.py changepassword username_goes_here
That will allow you to reset anybody's password; superuser or otherwise.
--
Regards,
Ian Clelland
--
You received this message because you are subscribed to the Google Grou
run in a few minutes.
>
>
> Thanks for any suggestions
>
>
> --
> 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 t
ango_models
...
GameProfile.objects.get(
django_models.Q(nick=nick) | django_models.Q(user=self.user),
world=self.world,
)
to see if the problem goes away. If it does, it's almost definitely a
redefined name.
--
Regards,
Ian Clelland
--
You
0) from mydatabase_votecontext left join
mydatabase_vote on (mydatabase_vote.context_id = mydatabase_votecontext.id)
where thing='Carrot' and user='Me'
There still might be a way to do it with the ORM; but you can definitely
use raw sql for this.
--
Regards,
Ian Clelland
--
You received this messa
e WHEREs (not filtering by user or thing), it still
> presents without nulls (or 0.0)
> Is there other way you can see?
> Again, thanks
> On 6 Dez, 21:48, Ian Clelland wrote:
> > On Tue, Dec 6, 2011 at 1:35 PM, Reinout van Rees >wrote:
> >
> > > Ah! Now I get
modular.
>
> --
> 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 email to
django-users+unsubscr...@googlegroups.c
modular.
>
> --
> 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 email to
django-users+unsubscr...@googlegroups.c
On Thu, Dec 8, 2011 at 12:45 PM, wgis wrote:
> Ian Clelland, it worked! Thanks a lot for your perseverance
>
> Tom's secret sauce it's not working, unfortunately =(
> Just (Carrots, Flavour, 3.0)
> I guess since some 'contexts' don't have an associated th
html", RequestContext({"base_template":
base_template...}))
Template: (my_template.html)
{% extends base_template %}
(In a real app, I would use a base class for the view which would set the
base template for every request automatically, or I would do it in a
context proces
transaction will be
committed to the database, and if the view raises error, the transaction
will be rolled back automatically. In almost every case, this behaviour
will be exactly what you want.
--
Regards,
Ian Clelland
--
You received this message because you are subscribed to the Google Groups
&
On Monday, December 19, 2011, J. Marc Edwards <
marc.edwa...@nimbisservices.com> wrote:
> I'd like to write a paragraph on my page that describes the {{ }} syntax,
but the template interpreter is interpreting the braces.
I think what you need is the {% templatetag %} tag -- it outputs template
tag
filter() rather than get, if you
can't ever assume uniqueness
- Similarly, if you have to update records, use update() rather than save().
It sounds like you want to use aggregate queries on this table anyway, so
you (hopefully) shouldn't run into any issues.
Oh, and don't r
7;],
MessierMarathon.objects.filter(messier_number=x['messier_number'],
nominations=x['nominations'])[0].image) for x in highest_counts)
You might be better off writing raw SQL for it, though; you could probably
get it all with one (convoluted) query.
--
Regards,
Ian Clell
k that you are going to need some lines that actually update the
'this' and 'customer' object. You would do that like this:
this.number = this.number + 1
or
customer.reference = number
Then, when you save the objects (and just use "customer.save()", the
force_update=True i
port [2]
[1] https://github.com/petehunt/PyMySQL
[2] http://mysql-python.blogspot.ca/2012/09/a-brief-history-of-mysqldb.html
--
Regards,
Ian Clelland
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send e
SQL like this:
CREATE TABLE "employee_employee" (
"id" serial NOT NULL PRIMARY KEY,
"person_id" integer NOT NULL,
"address_id" integer NOT NULL
)
;
which is probably closer to what you're expecting.
--
Regards,
Ian Clelland
--
You received this
their parent, without the parent having a
child_set attribute.
I think Mike has the right idea; using a separate 1:many table to avoid
explicit fields on the child model, but, of course, SQL being what it is, it
is still possible to construct a query that joins the tables and
reconstructs the l
.filter(title__icontains="test").extra(where='oe_matches(structure.smiles,
"[C;!H0]")')
You could encapsulate the extra() call in a function call that annotates a
QuerySet that you pass to it, but it's 'outside' of the ORM at that point.
--
Regards,
Ian Cl
only the one test that you specify will actually be run.
--
Regards,
Ian Clelland
--
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, sen
to them to compress it.
>
> When I try to do this:
>
> file.write(zlib.compress(file.read()))
Don't do that -- I'm pretty sure that writing a file that you already have
open for reading will produce undefined results.
(Also, I'd try to stay away from using 'file&
sts. I believe that Django will issue the redirect anyway, buy the
user agent is *not* supposed to just blindly post the data to the new URL
without some sort of user interaction.
To eliminate this as a possible error source, try putting the trailing "/"
on the URL in the command line:
$
k* into a float; you
should use .quantize() instead.
--
Regards,
Ian Clelland
--
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 e
omes back to the confirmation view. If your tokens
are actually random, and large enough (say, 64 bits), then anybody trying to
guess them will be wasting their time.
--
Regards,
Ian Clelland
* By looking at the database IDs, people can gauge how heavily the system is
being used, or if they s
ailMessage, set the headers yourself, and call send() on it.
(Also, 'text/us-ascii' is not a registered MIME type; you probably want to
say something like 'text/plain; charset=us-ascii')
[1]
http://docs.djangoproject.com/en/1.3/topics/email/#the-emailmessage-class
--
Rega
from django.utils import simplejson as json
...
records = models.Residents.objects.extra( where=[], params=[...])
data = json.dumps(records.values('fname','lname','pt'))
return HttpResponse(data, mimetype='application/json')
records.values
0.9.7.2), but I don't want to mess
> around with the production environment too much, or risk breaking the
> live sites.
>
If the error is in one of the python core modules, then it may have been
fixed recently; but I haven't seen any reports of failures in tupleobject.c
other th
ticle.objects.values('category').annotate(count=models.Count('id'))
? The idea being that you group the objects by category, and then count the
number of distinct ids within each category.
The docs mention that the default ordering can get in the way of this
sometimes,
tring "META" doesn't even occur in the db package,
so I can't imagine how simply wrapping a QuerySet in a list() call could
trigger an exception like that.
Can you post the rest of the code around this, or at least more of a
traceback, unless that is really all that there is? And
, and its
accompanying META attribute.
Check to see if that's the case, and rename your list() view if it is.
--
Regards,
Ian Clelland
--
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@
from django.utils.simplejson import dumps
...
school_list = dumps([school.name for school in city.school_set.all()])
and then add school_list to the context variables that are passed to the
template. Then in the template, you can just use {{ school_list }}, and it
will be a properly
gt; > email = forms.EmailField()
> > > message = forms.CharField()
> > > name = forms.CharField()
> >
> > > #urls.py
> > > urlpatterns = patterns('',
> > > ...
> > > (r'^contact-form/', views.contact)
ieval)
4. If you can get the right data out of the database in the python shell,
then can you save it from there as well? If everything above works, then try
doing this:
> object_from_database.save()
and see if you get the same error. If so, posting a traceback from that
might help pinpoint th
JavaScript, so what you're going to have to do is come
up with a sample of what you'd *like* to see as the template output, and
hopefully we can help you with the Django template code to produce that
output.
[Also, it really doesn't help to be posting and reposting the same questi
t; 3. Break up your API calling code into more testable units to truly
> > isolate your independent code from the API calling code. It'll be much
> > easier to catch problems in the API integration code.
>
> --
> You received this message because you are subscribed to the
here, but it is not used internally by the form machinery.
>
> However, this is looking like a legitimate bug to me.
>
> http://dpaste.com/hold/556603/
>
>
I've updated with a working example, as http://dpaste.com/hold/556805/
--
Regards,
Ian Clelland
--
You received this
e the tests without touching the
> actual view logic, so testing what the API receives makes the most
> sense to me.
>
If this is all for a refactoring, then you're probably on the right track
there -- instrument the existing object for testing, rather than
restructuring the view f
1 - 100 of 131 matches
Mail list logo