Re: Django won't create foreign keys

2008-01-27 Thread Matti Haavikko
Hi, I experienced the same problem. I found an earlier ticket on this same error and reopened it. See http://code.djangoproject.com/ticket/2130 The fix you suggested fixes the problem for me. I've added it to the comments of the ticket. - Haavikko apramanik wrote: > Anyone? I still haven't g

Find a man at www.SexDatingPoint.com

2008-01-27 Thread SessionDrummer
Find a man at www.SexDatingPoint.com find a man looking for a woman at www.SexDatingPoint.com meet adult male at www.SexDatingPoint.com men seeking women at www.SexDatingPoint.com women seeking men www.SexDatingPoint.com woman seeking man www.SexDatingPoint.com woman looking for man www.SexDatingP

Re: Django multilingual

2008-01-27 Thread maco
Can you share the logic behind the models and views you use. Don't need to go into details, just the philosophy behind it, eg. http://orestis.gr/en/blog/2007/05/14/international-part3/ cheers On Jan 26, 5:36 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > Piotr, having django-multilingual featu

Multi-page search result

2008-01-27 Thread Wanrong Lin
Hi, I wonder whether I can learn some best practice here on how to do multi-page search result, similar to what Google does. My search is computation intensive, and it will be very expensive to do the search all over from beginning when the user clicks on "next page". I am thinking about st

exists created_at or updated_at ?

2008-01-27 Thread Claudio Escudero
Anyone know if there is something like created_at or updated_at of Ruby on Rails. These fields are filled automatically when saving and editing? The date of saving and editing Thanks, Claudio Escudero --~--~-~--~~~---~--~~ You received this message because you are

Best practice for implementing multilingual content in template

2008-01-27 Thread Emil
Hi! I'm currently working on a couple of sites where basically all content is to be available in two languages. I haven't used django- multilingual or anything readymade, but simply created double fields in my models for all content in the db that needs to be available in both languages. For exam

Re: Multi-page search result

2008-01-27 Thread gordyt
Hi Wanrong, This is a very good question. I had a similar problem that I ended up solving with a non-Django solution because I was adding it to an existing PHP-based site. But I would like to describe what I ended up doing to see if it would be possible to adapt it to Django. In out case we ha

Re: Best practice for implementing multilingual content in template

2008-01-27 Thread Wanrong Lin
Emil, I am having the same problem too. I have not gone that far to implementing the details of templates, but my planned solution is to use just one template without any language dependent switching. Instead, I will write some code to extract the relevant fields (title_en or title_sv as in y

Re: SESSION_SAVE_EVERY_REQUEST creates new session?

2008-01-27 Thread Ramiro Morales
On Jan 6, 2008 10:58 AM, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > [...] > The situation is a little subtle: by default, we use the same session > cookie name for every Django site. You can change that. In fact, when I > first saw this message, I couldn't repeat the problem because the case

How can I parse and process the contents of an URL?

2008-01-27 Thread MariusB
I'm trying to take a link as an argument, open it, read it's content and then display the first 50 characters from it. First of all, I've tried to put the code in the views.py, but I didn't make it. Now I made a middleware component with this code: import urllib2 from django.shortcuts import rend

Admin page url reference problem

2008-01-27 Thread paceman
I seem to be having a problem with the django Admin facility. I have used it quite some time with no problems, however, I ran into a problem and it may relate to how I tried to solve some other problems. So here is some background that may be important. Background: *

Re: Best practice for implementing multilingual content in template

2008-01-27 Thread Emil
On 27 Jan, 19:34, Wanrong Lin <[EMAIL PROTECTED]> wrote: > Emil, > > I am having the same problem too. I have not gone that far to > implementing the details of templates, but my planned solution is to use > just one template without any language dependent switching. Instead, I > will write some c

Using a Python module

2008-01-27 Thread MariusB
I have a Python module with two classes: - one for crawling and creating the database, - and the other for doing full-text searches by querying the SQLite database. How can I use this module in Django, to import it or something? I want to pass on the arguments from the Web form to my module and

best configuration options for background processes

2008-01-27 Thread [EMAIL PROTECTED]
I'd like to run a few background processes on my server. They need access to the models in my app, the database, and the whole django framework. Other threads have mentioned how best to run them. Cron is the clear solution. The question I have is how best to configure them. Loading a script in

Re: Using a Python module

2008-01-27 Thread Jeff Anderson
Yes, just import it! django is still python! In the docs, there is an example on how to dynamically generate pdfs. This calls an external python module. http://www.djangoproject.com/documentation/outputting_pdf/ I do this in one of my projects. You can import any python module you want! Jeff A

Re: best configuration options for background processes

2008-01-27 Thread shabda
http://www.b-list.org/weblog/2007/sep/22/standalone-django-scripts/ On Jan 28, 12:39 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I'd like to run a few background processes on my server. > > They need access to the models in my app, the database, and the whole > django framework. > > Othe

Announce: 7days7apps.com

2008-01-27 Thread shabda
Hi Every one, Just wanted to let everyone know of www.7days7apps.com , where I am trying to build and deploy 7 small but useful apps in 7 days. By now I have completed 5 apps. All of them are released under GPL, and the source for them is available at http://code.google.com/p/7days7apps/ . If you

Re: exists created_at or updated_at ?

2008-01-27 Thread James Bennett
On Jan 27, 2008 10:54 AM, Claudio Escudero <[EMAIL PROTECTED]> wrote: > Anyone know if there is something like created_at or updated_at of Ruby on > Rails. > These fields are filled automatically when saving and editing? For any DateField or DateTimeField, you can tell Django to automatically up

Re: django-queue-service documentation

2008-01-27 Thread Tane Piper
Hrm, looking at it, this looks very interesting for my project too! My project has a bottleneck, and if I describe it, possibly you could confirm or deny if your app will be useful. Our application is for managing mercurial repositories. Part of the functionality is to be able to create new rep

Re: best configuration options for background processes

2008-01-27 Thread [EMAIL PROTECTED]
thanks! On Jan 27, 12:10 pm, shabda <[EMAIL PROTECTED]> wrote: > http://www.b-list.org/weblog/2007/sep/22/standalone-django-scripts/ > > On Jan 28, 12:39 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > I'd like to run a few background processes on my server. > > > They need access to t

Re: Multi-page search result

2008-01-27 Thread Wanrong Lin
Hi, Gordon, Thanks a lot for sharing the details of your solution on this problem. So far I don't see any approach better than what you did, namely storing the results in some temporary place that is tied to a session. So I think I will just go along with this approach. I have not read carefu

Re: Best practice for implementing multilingual content in template

2008-01-27 Thread Jonathan Ballet
Hi! Le Sun, 27 Jan 2008 09:03:25 -0800 (PST), Emil <[EMAIL PROTECTED]> a écrit : > Hi! > > I'm currently working on a couple of sites where basically all content > is to be available in two languages. I haven't used django- > multilingual or anything readymade, but simply created double fields

Re: Best practice for implementing multilingual content in template

2008-01-27 Thread code_berzerker
I think that better idea would be doing something like that (I'm using even more complicated models myself): class Page(models.Model): #parent page in tree of pages parent = models.ForeignKey('self', related_name="children", blank=True, null=True) slug = models.SlugField(u

multiple function arguments

2008-01-27 Thread road
This may be more of a python question rather than django, but I figured it could be answered here. I'm getting a type error when I try and call a function with multiple arguments. Error Message: "create_doc_images() takes exactly 1 non-keyword argument (2 given)" relevant code: Class Doc(Model

Re: Multi-page search result

2008-01-27 Thread SmileyChris
Using the low-level cache [1] sounds like it'd work fine for you. from django.core.cache import cache key = 'complex-results-%s' % request.session.id results = cache.get(key) if results is None: results = list(YourComplexQuery) cache.set(key, results, 60*15) # then just use pagination to

Re: multiple function arguments

2008-01-27 Thread Ned Batchelder
You need to read up on how Python methods work: there is a "self" argument that must be declared, and that receives the object of the call: class Fooey: def my_method(self, arg1, arg2): # blah blah foo = Fooey() foo.my_method(1, 2) my_method is declared with three argum

Re: django-queue-service documentation

2008-01-27 Thread Joseph Heck
Sorry for the lack of docs - I think we've all been focused elsewhere, and the project is being somewhat quiet right now. Do you want to integrate it into your application directly, or use it as a standalone critter? What kind of information on using it would be most useful to you? I've got some

Re: exists created_at or updated_at ?

2008-01-27 Thread Claudio Escudero
thanks On Jan 27, 2008 6:40 PM, James Bennett <[EMAIL PROTECTED]> wrote: > > On Jan 27, 2008 10:54 AM, Claudio Escudero <[EMAIL PROTECTED]> wrote: > > Anyone know if there is something like created_at or updated_at of Ruby > on > > Rails. > > These fields are filled automatically when saving and

Re: website side component processing

2008-01-27 Thread [EMAIL PROTECTED]
I think that what you're looking for is context processors. James Bennett has an excellent writeup [1] that I'd suggest looking at. [1] http://www.b-list.org/weblog/2006/jun/14/django-tips-template-context-processors/ On Jan 27, 5:29 pm, code_berzerker <[EMAIL PROTECTED]> wrote: > I'm quite ne

Re: Django multilingual

2008-01-27 Thread Ivan Illarionov
Models that need flexibility have `lang` and `is_translation_of` fields. Views (or custom managers) filter the output based on `lang` and add the link to other language if translation exists. Some models just have two separate text fields for each language and views (or custom managers) display th

website side component processing

2008-01-27 Thread code_berzerker
I'm quite new to django/python (migrating from php). I've been developing cms-like web applications for years now. Now I'm trying to create quite advanced CMS using django. Lately I moved from doing simple tests in django to tearing other peoples django apps into pieces to get the idea of best pra

Re: TypeError when accessing a RelatedManager?

2008-01-27 Thread orestis
OK, I got it. I was defining my own managers on Episode, and there was no default manager. Adding an objects=models.Manager() solved it. Maybe this should be added to the documentation? Should I create a ticket? On Jan 28, 1:56 am, orestis <[EMAIL PROTECTED]> wrote: > This is VERY WEIRD: > > In [

django datetime wrong on OS X

2008-01-27 Thread [EMAIL PROTECTED]
My clock while in a django process is 8 hours faster than in a normal python process Within django: >>> print "datetime.datetime.now()=%s " % datetime.datetime.now() datetime.datetime.now()=2008-01-28 00:52:27.475639 Outside django >>> print "datetime.datetime.now()=%s " % datetime.dateti

Re: ForeignKey _id not so transparent

2008-01-27 Thread msoulier
On Jan 27, 12:46 am, "James Bennett" <[EMAIL PROTECTED]> wrote: > You can assign a numeric ID of a TugInstance object to 'instance_id' > on a Client object. > > You can assign an actual honest-to-goodness TugInstance object to > 'instance' on a Client object. Ah, that helps. The docs don't seem t

Re: Multi-page search result

2008-01-27 Thread gordyt
SmileyChris the ObjectPaginator is cool and I'm glad you pointed it out. In my particular case I needed to be able to do more than just paginating large datasets, but for the O.P. it sounds great! --g --~--~-~--~~~---~--~~ You received this message because you a

Re: django datetime wrong on OS X

2008-01-27 Thread [EMAIL PROTECTED]
I removed a function call that relied on knowing the exact date. Still in my view, I print print "datetime.datetime.now()=%s" % datetime.datetime.now() Oddly enough, it is getting called twice per page view. This is more odd behavior. On Jan 27, 4:58 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]

TypeError when accessing a RelatedManager?

2008-01-27 Thread orestis
This is VERY WEIRD: In [2]: import django In [3]: django.get_version() Out[3]: u'0.97-pre-SVN-7031' In [4]: from leach.models import Category In [5]: a = Category.objects.all()[0] In [6]: a.episodes --- TypeError

Re: Announce: 7days7apps.com

2008-01-27 Thread 1234
good~~~ it's very cool~~ 2008/1/28, shabda <[EMAIL PROTECTED]>: > > > Hi Every one, > > Just wanted to let everyone know of www.7days7apps.com , where I am > trying to build and deploy 7 small but useful apps in 7 days. By now I > have completed 5 apps. All of them are released under GPL, and th

Re: django datetime wrong on OS X

2008-01-27 Thread [EMAIL PROTECTED]
The timezone was incorrectly set to the east coast US, and I'm now on the west coast. This is my time zone string TIME_ZONE = 'US/Pacific' Not sure why the function was pinged twice though. On Jan 27, 5:09 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I removed a function call that reli

Multiple columns for db_indexes ?

2008-01-27 Thread Hugh Bien
Hi, I've been googling around for a while, but I haven't found a way to create indexes with multiple columns, ie. class Person(models.Model): last_name = models.CharField(maxlength=255) first_name = models.CharField(maxlength=255) And then create an index (last_name, first_name). Thanks

Multiple sites

2008-01-27 Thread LRP
Hello, I'm speculating on how to replicate a site (same structure and functionality, different url and content). Am I correct that it would go as follows? 1) Create a new database 2) Assuming that the first site is in .../django/firstsite; make directory .../django/secondsite 3) Copy content

Re: Multiple sites

2008-01-27 Thread James Bennett
A better solution: 1. Completely forget that you ever learned from any source that it might be a good idea to have a project folder with the apps inside it; the tutorial does that because it's simpler and easier for purposes of introducing Django, but in real-world situations it's generally a ter

Re: Multiple columns for db_indexes ?

2008-01-27 Thread James Bennett
On Jan 27, 2008 10:35 PM, Hugh Bien <[EMAIL PROTECTED]> wrote: > I've been googling around for a while, but I haven't found a way to create > indexes with multiple columns, ie. Several options: 1. Instead of 'syncdb', use the 'sqlall' option of manage.py and pipe the SQL into a file, then edit i

check if model instance exists

2008-01-27 Thread [EMAIL PROTECTED]
Is there a better way to check if there are any hits on a query than using query.count()>0 ? I find myself doing something like this a lot: modelList = MyModel.objects.filter(someMember=m) if modelList.count() > 0: return modelList[0] I really don't care how many there are, so the count might

Hey Django-users@googlegroups.com ;)

2008-01-27 Thread Arko Basu
http://www.hi5.com/register/1OHMD?inviteId=B_b2cd5c2_OBb.FZSmoPd arko --~--~-~--~~~---~--~~ 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 un

Re: check if model instance exists

2008-01-27 Thread [EMAIL PROTECTED]
I believe you can just do if query: This will execute the query, so if it is a particularly intensive one you may want to come up with a simpler version of it for testing existance. On Jan 28, 12:10 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Is there a better way to check if there are

Error Message Best Practice Question

2008-01-27 Thread [EMAIL PROTECTED]
I have a newform that accepts credit card input. Users can have multiple credit cards stored in the system. In the process of the user adding credit cards I want to check that there are no duplicates. I am doing the following... if not CreditCard.objects.filter(number=form.cleaned_dat

Re: Error Message Best Practice Question

2008-01-27 Thread Ivan Sagalaev
[EMAIL PROTECTED] wrote: > This seems kind of hacky, but it really seems like it makes sense to > show this as a form error. The only other way I could think to solve > this was to pass the request to the model and then check the above in > the clean method, however this seems just as bad as it br