Hello,
I have a site that offers a bunch of appartments for rent. Each of
these rentals has a image gallery showing the look&feel of that place.
My models currently look like this:
class Photo( models.Model ):
name = models.ImageField( upload_to='rentals' )
class Rental( model.Model ):
On 16-Mar-07, at 10:31 AM, Michael Lake wrote:
> Hi all
>
>>> On 14-Mar-07, at 12:02 PM, Michael Lake wrote:
The textarea is about two lines high only. I want the text entry
box to be much bigger as it will be holding a full page of text ...
>
> Kenneth helped out and suggested this:
>
Hi all
>>On 14-Mar-07, at 12:02 PM, Michael Lake wrote:
>>>The textarea is about two lines high only. I want the text entry
>>>box to be much bigger as it will be holding a full page of text ...
Kenneth helped out and suggested this:
>>widgets.TextArea(attrs={'rows':10,'cols':60}) for example
T
I've got one view where I want the queryset to be a standard
objects.all(), but I also want to use a datetime.now() to pass in
"upcoming" events. I do this:
def get_upcoming():
return
Event.objects.filter(end_date__gte=datetime.now()).order_by('end_date')
urlpatterns = patterns('django.view
On Fri, 2007-03-16 at 00:06 +0100, Sandro Dentella wrote:
> Hi all,
>
> I'm using _thread_locals as in:
> http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser
> to keep track of the user that triggered operation in contexts where
> request.user is not available (eg: managers).
>
Hi all,
I'm using _thread_locals as in:
http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser
to keep track of the user that triggered operation in contexts where
request.user is not available (eg: managers).
I realize now that signal do not preserve it (I guess that are run i
On 3/15/07, Matias Surdi <[EMAIL PROTECTED]> wrote:
> published_posts_dict = {'queryset':
> Post.objects.filter(pub_date__lte=datetime.now()).filter(status='PB').order_by('-pub_date')}
>
> the problem is, with the filter pub_date__lte=datetime.now() .
>
> What happens,is that when I add a new post
On 3/15/07, Alexander Solovyov <[EMAIL PROTECTED]> wrote:
>
> Any comments? What I can do to serialize and deserialize my models
> with GenericRelations?
GenericRelations are a bit of a wierd case - they're available in
Django, but they're still a prototype feature - they're not fully
documented
On Mar 15, 3:13 pm, "Grupo Django" <[EMAIL PROTECTED]> wrote:
> Note: I can't use "form_for_model" because it doesn't validate the
> date fields all right.
Define validation methods for your date fields, e.g.:
def clean_fecha_inicio_publicacion(self):
dt = self.clean_data['fecha_inic
Malcolm Tredinnick escribió:
>
> On Thu, 2007-03-15 at 21:53 +0100, Matias Surdi wrote:
>> Hi,
>>
>> I'm my urls.py I have the following queryset for a generic view:
>>
>> published_posts_dict = {'queryset':
>>
Post.objects.filter(pub_date__lte=datetime.now()).filter(status='PB').order_by('-pu
> Another data point:
I figured out the problem...
I had a 'global' directory called 'middleware' in which I had a module
called 'threadlocals'.
in /model.py I had:
import middleware.threadlocals as locals
The problem was that I also have a 'middleware.py' in that app, so
python was doing
I'm starting to think I should just email you directly with my
problems, Malcom :D Thanks a lot - I've done that sort of thing
before, but just wasn't thinking of it, it's definitely a fine stopgap
solution.
Since you seem to agree about adding the method to QuerySets in
general, I'll throw a qui
On Thu, 2007-03-15 at 21:17 +, Jeff Forcier wrote:
[...]
> The problem is that QuerySets are not Managers, and so I will find
> myself mucking with these objects in various spots and not knowing
> offhand whether a given relationship attribute has e.g. the .all()
> method, or not. If it's a re
On Thu, 2007-03-15 at 21:53 +0100, Matias Surdi wrote:
> Hi,
>
> I'm my urls.py I have the following queryset for a generic view:
>
> published_posts_dict = {'queryset':
> Post.objects.filter(pub_date__lte=datetime.now()).filter(status='PB').order_by('-pub_date')}
>
> the problem is, with the f
> I think to put the id of the object on the "upload_to" keyword but I
> don't know if this is possible.
> Is there a way to ensure the filename is unique for that model?
Actually, Django already takes care of this for you. It adds
underscore(s) to your upload file's name until the filename is un
Hi all,
I have an object hierarchy with varying levels of depth, and have a
few relationships that span multiple objects - in other words, if A is
related to B which is related to C, I will want to find all As related
to a given C object, even though they are *indirectly* related.
Since I use th
Hi,
I'm my urls.py I have the following queryset for a generic view:
published_posts_dict = {'queryset':
Post.objects.filter(pub_date__lte=datetime.now()).filter(status='PB').order_by('-pub_date')}
the problem is, with the filter pub_date__lte=datetime.now() .
What happens,is that when I add a
ScottB wrote:
> One thing to consider when serving a working copy is all those .svn
> directories could be accessible via your web server. Assuming your
> code isn't within your web server's root (which it shouldn't be),
> there's probably not much that can go wrong. Still, it might be worth
> c
Malcolm Tredinnick schrieb:
> On Thu, 2007-03-15 at 19:22 +0100, Paul Rauch wrote:
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA1
>>
>> Hello,
>>
>> I use django with python 2.5.
>> I already got the same error during tutorial step 2, but for whatever
>> reason noone answered my question abou
On 13/03/07, Sengtha <[EMAIL PROTECTED]> wrote:
>
> I am currently working on one project which needs to view page on
> browser that doesn't support cookies.
> By what I know, all Django sessions are based on browser cookies. And
> Django sessions are save in django_session table. I wonder there i
On 14/03/07, Alexander Boldakov <[EMAIL PROTECTED]> wrote:
>
> The web pages served in my django applications are not static media
> files, but dynamically generated content (the result of applying XSLT
> transformation to the XML data retrieved from XML database). I
> consider the architecture of
Thanks again, Malcom -- I see what you mean, you're quite right. I do
keep forgetting that things are passed by reference, and that
definitely explains it - it also explains why the data corruption
limits itself to individual URL files (i.e. in this particular
instance, I only saw 'extra' info bel
On 15/03/07, DuncanM <[EMAIL PROTECTED]> wrote:
>
> I have 2 classes:
This post is really too long to be able to understand what and where
it's going on.
"Revision matching query does not exist" is usually caused when you're
trying to select something out of the database and your query coudn't
m
On 3/15/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
> it's entirely up to you how you set that up. I use the latter form of
> imports all the time in my work -- if all the apps are under a single
> project directory (which isn't always true), I point the Python path to
> the project director
On 15 mar, 19:38, "Rubic" <[EMAIL PROTECTED]> wrote:
> On Mar 15, 10:06 am, "Grupo Django" <[EMAIL PROTECTED]> wrote:
>
> > Hello, I think I have seen some way to fill aselectfield with data
> > from a table, but I'm not 100% sure and I can't find it anywhere. Is
> > it possible?
>
> ## models.p
>> ... INNER JOIN tblBig b ON
>> (b.other_id = other.id AND
>> b.foo = 42 AND
>> b.bar = 'zip'
>> )
>>
>> the cartesian product makes the join huge. I've performance
>> tested the resulting queries at the psql prompt, and the above
>> version runs in under 2 seconds. D
> I need to retrieve latest record (each record has a time stamp,
> created_at), only one record, from sale table where product_id=1. How
> do I do this in Django ORM? I have looked at .objects.extra{}, but I
> am getting ProgrammingError 1064.
>
> I need to get this sql into Django ORM:
>
> sel
On Thu, 2007-03-15 at 19:22 +0100, Paul Rauch wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hello,
>
> I use django with python 2.5.
> I already got the same error during tutorial step 2, but for whatever
> reason noone answered my question about this here...
> Now the same error
On Thu, 2007-03-15 at 11:11 -0700, Michael Cuddy wrote:
>
> When importing modules, I think that it's ugly to have to use the
> 'site' name on modules ... f'rinstance:
>
> from mysite.myapp.views import MyView, MyOtherView
> from mysite.myapp.models import MyModel, MyOtherModel
>
> Fro
On Thu, 2007-03-15 at 08:31 -0500, Tim Chase wrote:
> I'm trying to inject a table into my query, but need to do an
> INNER JOIN with a custom ON clause. This is due to the volumes
> of data in the joined table. Without being able to do something like
>
>
> ... INNER JOIN tblBig b ON
>
On Mar 15, 12:30 pm, "Tipan" <[EMAIL PROTECTED]> wrote:
> Realised my daft error in creating the dictionary. I've resolved that
> now and can happily pass the queryset data to the Form class by
> creating the dict. However, I'm still not sure how to pass the number
> of records to the Form class.
On Thu, 2007-03-15 at 15:10 +, Jeff Forcier wrote:
> Oh, one more thing - here is one of the views whose data appears to be
> getting mixed up with the one I showed in the previous email, for
> reference:
>
> ### views/engagements.py
>
> def conflicts(request,**kwargs):
> kwargs['extra_c
On Thu, 2007-03-15 at 15:07 +, Jeff Forcier wrote:
> Thanks a lot for the reply, Malcom!
>
> Here's an example of the sort of urlconf/view setup that I've got. The
> code has some legacy junk that looks odd (like 'session_extract'
> instead of simply calling request.session.xyz) but is there
[reference: http://www.djangosnippets.org/snippets/82 ]
Tipan,
>From your code I think you may be confusing a dictionary
key with a list index.
> data_list=UserPoints.objects.filter(user = myuser)
> for i in data_list:
> k='type_%d' % i
> l='points_%d' % i
Note in line #28 how I'm defi
> Uhm, please ignore this email, it looks like this can't be done using
> transactions
>
> begin transaction;
> update book set "order"=2 where id=1;
> update book set "order"=1 where id=2;
> commit;
>
> ERROR: duplicate key violates unique constraint "book_order_key"
Alternatively, if you wan
Tim Chase wrote:
> Which follows the pattern
>
>UPDATE tbl
>SET field = (
> SELECT SUM(field)
> FROM tbl
> WHERE [EMAIL PROTECTED] or [EMAIL PROTECTED]
> ) - field
>WHERE [EMAIL PROTECTED] or [EMAIL PROTECTED]
>
> Any help?
>
> -tkc (aka "the atomic swapper"? :)
> Uhm, please ignore this email, it looks like this can't be done using
> transactions
>
> begin transaction;
> update book set "order"=2 where id=1;
> update book set "order"=1 where id=2;
> commit;
for atomic swapping, however, it can be done in a single obscure
SQL statement:
update boo
Bram - Smartelectronix wrote:
> Rubic wrote:
>> Bram,
>>
>> Try removing (commenting out) the transaction decorator
>> and transaction.commit(), then re-run your code. The
>> ProgrammingError exception may be hiding the real
>> exception. At least that's been my experience.
>
> Nope..., I'm rea
Rubic wrote:
> Bram,
>
> Try removing (commenting out) the transaction decorator
> and transaction.commit(), then re-run your code. The
> ProgrammingError exception may be hiding the real
> exception. At least that's been my experience.
Nope..., I'm really getting the "unique key violation" on
Bram,
Try removing (commenting out) the transaction decorator
and transaction.commit(), then re-run your code. The
ProgrammingError exception may be hiding the real
exception. At least that's been my experience.
--
Jeff Bauer
Rubicon, Inc.
--~--~-~--~~~---~--~
On Mar 15, 10:06 am, "Grupo Django" <[EMAIL PROTECTED]> wrote:
> Hello, I think I have seen some way to fill a select field with data
> from a table, but I'm not 100% sure and I can't find it anywhere. Is
> it possible?
## models.py ##
from django.db import models
class Team(models.Model):
n
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hello,
I use django with python 2.5.
I already got the same error during tutorial step 2, but for whatever
reason noone answered my question about this here...
Now the same error occured on tut4.
It happended, when I added the generic views.
Here my
When importing modules, I think that it's ugly to have to use the
'site' name on modules ... f'rinstance:
from mysite.myapp.views import MyView, MyOtherView
from mysite.myapp.models import MyModel, MyOtherModel
>From a modularity standpoint, it would be much nicer to just
say:
fr
Realised my daft error in creating the dictionary. I've resolved that
now and can happily pass the queryset data to the Form class by
creating the dict. However, I'm still not sure how to pass the number
of records to the Form class.
Can you advise?
Tim
--~--~-~--~~~--
I now sort of do what you proposed. I override the init. But for the
attributes that I want to keep track of I create create a property.
Then it's a matter of counting how often it has been accessed. Now I
just need inherit from both Model and DateTimeFieldHelper :)
--
I now sort of do what you proposed. I override the init. But for the
attributes that I want to keep track of I create create a property.
Then it's a matter of counting how often it has been accessed. Now I
just need inherit from both Model and DateTimeFieldHelper :)
--
> I've posted a code snippet that I think addresses your
> issue:http://www.djangosnippets.org/snippets/82/
>
Jeff, this was very helpful and I've moved on a bit, I can make your
form do exactly what it's supposed to. Howver I'm still struggling to
pass my information to the Form class.
I note t
johnny wrote:
> I need to retrieve latest record (each record has a time stamp,
> created_at), only one record, from sale table where product_id=1. How
> do I do this in Django ORM? I have looked at .objects.extra{}, but I
> am getting ProgrammingError 1064.
>
> I need to get this sql into Djan
On 3/15/07, johnny <[EMAIL PROTECTED]> wrote:
> I need to retrieve latest record (each record has a time stamp,
> created_at), only one record, from sale table where product_id=1. How
> do I do this in Django ORM? I have looked at .objects.extra{}, but I
> am getting ProgrammingError 1064.
OK,
I need to retrieve latest record (each record has a time stamp,
created_at), only one record, from sale table where product_id=1. How
do I do this in Django ORM? I have looked at .objects.extra{}, but I
am getting ProgrammingError 1064.
I need to get this sql into Django ORM:
select created_at
Kenneth Gonsalves schrieb:
> never ever put settings.py under version control
ack.
In PyLucid i put only a settings-example.py into my svn:
http://pylucid.net/trac/browser/branches/0.8%28django%29/PyLucid/settings-example.py
In the handler file (here a CGI handler), i check this:
---
Oh, one more thing - here is one of the views whose data appears to be
getting mixed up with the one I showed in the previous email, for
reference:
### views/engagements.py
def conflicts(request,**kwargs):
kwargs['extra_context']['object_list'] = cases.get_list()
kwargs['extra_context'][
Hi everyone,
I have items that have an order. This function is supposed to move items
up (swapping the order with the previous item) or down (...). I tried
doing it via a transaction (as 'order' is logically unique), but on the
first save() it fails with a ProgrammingError:
@transaction.comm
On Mar 15, 2:14 pm, Atilla <[EMAIL PROTECTED]> wrote:
> On 15/03/07, skink <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > I'd like to start one thread in order to do some periodic actions.
>
> > It should be started automatically, not within some view code.
>
> > Where is the best place to start
Thanks a lot for the reply, Malcom!
Here's an example of the sort of urlconf/view setup that I've got. The
code has some legacy junk that looks odd (like 'session_extract'
instead of simply calling request.session.xyz) but is there due to a
previous server setup. I'm porting this code to 0.95 in
Hello, I think I have seen some way to fill a select field with data
from a table, but I'm not 100% sure and I can't find it anywhere. Is
it possible?
Thank you.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Djan
Michel Thadeu Sabchuk schreef:
> Hi guys,
>
> I want to be able to add a images with same filename but I don't want
> to replace old images when I repeat a name. Suppose I will add a
> object with an image field and the filename is image.jpg, I want to be
> able to add another object with another
Hi guys,
I want to be able to add a images with same filename but I don't want
to replace old images when I repeat a name. Suppose I will add a
object with an image field and the filename is image.jpg, I want to be
able to add another object with another file, but this file is called
image.jpg to
Hi all. What permission I must give to user that he can be albe to
watch content of some tables. Only watch - doesn't edit, add or drop
objects.
Gregor
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users"
Click on
http://groups.google.com/group/django-users/web/chicago-area-python-django-developer-position
- or copy & paste it into your browser's address bar if that doesn't
work.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the G
If it helps, I'm using anchors in a get_absolute_url() function in a
model for a forum app, and they're working just fine (even with
pagination).
def get_absolute_url(self):
paginate_by = 30
posts = self.thread.post_set.count()
if posts > paginate_by:
page = '?page=%s' % ((pos
I'm trying to inject a table into my query, but need to do an
INNER JOIN with a custom ON clause. This is due to the volumes
of data in the joined table. Without being able to do something like
... INNER JOIN tblBig b ON
(b.other_id = other.id AND
b.foo = 42 AND
On 15/03/07, skink <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'd like to start one thread in order to do some periodic actions.
>
> It should be started automatically, not within some view code.
>
> Where is the best place to start such thread?
>
> regards,
> skink
>
What kind of actions are you tal
Hi all!
In our project we have implemented tags through generic relations. And
if I try to dumpdata/loaddata (I use xml for serialization, but tried
to use json/python/yaml) I've get error:
=
Problem installing fixture 'product/fixtures/initial_data.xml': 'int'
object has no attribute 'c
Hi all. I try to edit user in DJANGO ADMIN, I can see user list but
when I click on one of them I get Page not found (404). I set
DEBUG=TRUE but still can't see why this is happening. I saw that there
was post in that case but I didn't found any solution. I use DJANGO
0.96 pre and database Postgre
On 3月14日, 下午7时43分, Steven Armstrong <[EMAIL PROTECTED]> wrote:
> Aidas Bendoraitis wrote:
>
> This might helphttp://www.htmldog.com/articles/suckerfish/
thank you :-)
regards.
张骛之
--~--~-~--~~~---~--~~
You received this message because you are subscribed to t
On 3月14日, 下午6时38分, "Aidas Bendoraitis" <[EMAIL PROTECTED]>
wrote:
> I'm not sure about IE7, but all the previous versions of IE certainly
> didn't support hover for other html tags than . So it is
> not Django issue at all. If you need some browser specific special
> effects, use javascript for
thanks a lot for that!
On Mar 15, 2:27 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hello Djuggernauts,
>
> I've just added an entire page to the wiki about tutorials (http://
> code.djangoproject.com/wiki/Tutorials), with subcategories etc.
>
> Please add any that I've missed to this pag
On 3/15/07, gnijholt <[EMAIL PROTECTED]> wrote:
>
> Just watched a co-worker demonstrate fixtures in Django, which worked
> fast and flawlessly.
Thats nice to hear. They're a recent addition, so its good to know
that they are stable and fast under serious use.
> >From what I understand, it take
Hi Vincent.
On Mar 14, 5:16 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Does anyone have tricks to make this process a bit more efficient and
> not catastrophic in case we forget to copy the settings.py file?
I use conditionals inside my settings.py so that one lot of paths/
settings ge
Thanks Mr. M
Even Tryed this
http://magpiebrain.com/blog/2005/08/21/formatting-dates-with-django/
Covered Both Example
But Unable to get any clue.
Unable to find any proper documentation / Code example for this
I am new to Django. Advanced Thank
Regards
On Mar 15, 12:23 pm, Malcolm Tredi
On 15-Mar-07, at 2:03 PM, skink wrote:
> Where is the best place to start such thread?
use cron
--
regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Goog
Just watched a co-worker demonstrate fixtures in Django, which worked
fast and flawlessly.
>From what I understand, it takes JSON or XML files, but is it also
possible to do Rails-style dynamic fixtures?
Would be nice to generate a fixture with a few lines of Python instead
of having to extract fr
Hi,
I'd like to start one thread in order to do some periodic actions.
It should be started automatically, not within some view code.
Where is the best place to start such thread?
regards,
skink
--~--~-~--~~~---~--~~
You received this message because you are s
On Thu, 2007-03-15 at 07:51 +, char wrote:
> I'd like to be able to do something like the following in views.py:
>
> return render_to_response( 'my_app/my_page.html/#my_anchor',
> context_instance=RequestContext( request ) )
>
>
> The above obviously doesn't work because it's just a filepat
Malcolm Tredinnick wrote:
> On Wed, 2007-03-14 at 21:16 +0100, Roland Hedberg wrote:
>> Hi Rubic,
>>
>> Rubic wrote:
>>> Roland,
>>>
>>> The error message isn't the most helpful. ;-)
>> I'll second that !
>>
>>> I had a similar problem back in January and tracked it
>>> down to ticket #2536. My
76 matches
Mail list logo