Re: Random File Path

2011-08-19 Thread Shawn Milochik
The reason it's generating the same one every time is that the code as written executes when Django starts and that name is kept until you restart your Django process. You can use a lambda to fix that in general Example: wrong: #all records get the datetime the Django process was

Django 1.3 logging not working as I'd expect

2011-08-19 Thread Scott Danzig
I have Django 1.3 working with Python 2.7 and MySQL 5.5 on Mac OSX Lion... I'm betting I'm missing something straight forward, but: I have a simple Django app in development that uses a dictConfig setting simpler than the default in settings.py: LOGGING = { 'version': 1, 'disable_existi

Random File Path

2011-08-19 Thread Ulisses Dias
Dear all, I'm creating a server that will receive a file and will generate an downloadable output. I would like to allow the user to come back later to get the output and to access his own input, since it takes some time to generate the output. So, my idea was to put the file in a folder

Re: Splitting models.py results in table rename?

2011-08-19 Thread Joshua Russo
Perfect! Thank you -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/NRyP256j0G4J. To post to this group, send email to django-users@googlegroups.com. To unsu

Re: Splitting models.py results in table rename?

2011-08-19 Thread Ramiro Morales
On Fri, Aug 19, 2011 at 11:42 PM, Joshua Russo wrote: > My models.py was getting too large so I tried to split it into > /models >   __init__.py >   someLogicalGroupOfModels.py >   andSoOn.py > in the __init__.py I have > from appName.models.someLogicalGroupOfModels import * > from appName.models.

Splitting models.py results in table rename?

2011-08-19 Thread Joshua Russo
My models.py was getting too large so I tried to split it into /models __init__.py someLogicalGroupOfModels.py andSoOn.py in the __init__.py I have from appName.models.someLogicalGroupOfModels import * from appName.models.andSoOn import * All of my imports still work but the queries are n

Re: "app_index.html" = i want to be in admin...

2011-08-19 Thread Nan
> where should i change https://docs.djangoproject.com/en/dev/topics/templates/#template-inheritance > and where to put this file..? https://docs.djangoproject.com/en/dev/ref/templates/api/#loader-types -- You received this message because you are subscribed to the Google Groups "Django user

Specific models without a database table

2011-08-19 Thread Kristofer Pettijohn
Hello, Is it possible to create specific models without a database table? Basically what I would like to do is create an email account management application that ties into my existing mail server and its API. I would like Django to have a Users model and keep track of users, a Domains model

Re: Possible interest in a webcast/presentation about Django site with 40mil+ rows of data??

2011-08-19 Thread Cal Leeming [Simplicity Media Ltd]
Hi all, Okay, good news and bad news. The bad news, is that the site/project which sparked this webcast to be made, has had some legal complications and is being shut down - less than 1 month after being released :L The good news, is that the webcast will still be going ahead. For those of you

"app_index.html" = i want to be in admin...

2011-08-19 Thread doniyor
hi there, i have a litle problem in bringing my app to admin. the thing is, i dont use models, so the talk about 'setting.py' would be wasty. what i dont understand is how to override the app_index.html and where to put it sothat my app can be seen in admin page.. i give the code of app_index.htm

how to invalidate per-view cache?

2011-08-19 Thread galgal
I want to use per-view cache. I know how it's working, but where's the problem? How can I invalidate that cache? I must do it each time database records are changed. There is no info about how to do that:/ -- You received

Re: Django Test Corrupted Test Data

2011-08-19 Thread patjenk
As I understand it, the database should be reset between each test. To me this means that unless the variable being examined is an attribute of self, the tests shouldn't affect each other. Could it be possible that there is a sqllite subtly that delays the reset of the table count and it affects t

Re: Dynamic Forms with Varying init Arguments

2011-08-19 Thread SixDegrees
OK, thanks. I was on the verge of rolling my own solution anyway. Form models won't work for me; although the ID I want to pass is a primary key to a table, I need to rummage around in the database and track down several bits and pieces; there's not a simple correspondence to one particular model

Re: Django Not Populating AutoField

2011-08-19 Thread Landy Chapman
On Aug 19, 2:05 pm, Lee wrote: > Landy - thanks for that idea. Am I correct in understanding that > setting a field to AutoField has no effect on save_model, and simply > causes dbsync to add the sequence/nextval to the Postgres table? I am not sure; On a droid phone so I can't look at the sour

Re: Nested: transaction.commit_on_success and django 1.3

2011-08-19 Thread aledema
On 28 Lug, 11:57, Gelonida N wrote: > I'm asking as this snippet is already 3 years old. you could try my snippet: http://djangosnippets.org/snippets/2515/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email t

Re: Django Test Corrupted Test Data

2011-08-19 Thread bikkit
Could it be that the tests affect each other (when ran in a series)? Sent from my BlackBerry® from Vodafone -Original Message- From: dm03514 Sender: django-users@googlegroups.com Date: Fri, 19 Aug 2011 12:13:24 To: Django users Reply-To: django-users@googlegroups.com Subject: Django Tes

Django Test Corrupted Test Data

2011-08-19 Thread dm03514
I have a test class that subclasses django.test.TestCase which has about 5 different tests in it. When I run my full test suite (using nose, and specifying sqlite as backend) there are a series of failures. When I go to debug the tests, running them individually, they pass fine. http://stackoverfl

Re: Dynamic Forms with Varying init Arguments

2011-08-19 Thread wayne
On Aug 19, 1:58 pm, SixDegrees wrote: > I'm no longer at the computer where my code resides. But "you are wanting to > call formset_factory > and have it pass along a parameter to the Form that the formset > contains" is pretty much what I want to know how to do. Well, the short answer is that yo

Re: Dynamic Forms with Varying init Arguments

2011-08-19 Thread SixDegrees
I'm no longer at the computer where my code resides. But "you are wanting to call formset_factory and have it pass along a parameter to the Form that the formset contains" is pretty much what I want to know how to do. Wayne Smith-4 wrote: > > On Aug 19, 12:41 pm, SixDegrees wrote: >> The param

Re: Strange behavior in model.save()

2011-08-19 Thread David Jacquet
Yes, it is the same thing. What I wonder is if there is a standard or better way of getting the same functionality as my full_save method? Regards David 2011/8/19 Yaşar Arabacı > I don't quite understand what you did there, but, it seems to me it is the > same thing with your initial post.

Re: Best approach to handling different types of Users

2011-08-19 Thread DrBloodmoney
On Fri, Aug 19, 2011 at 9:27 AM, Andre Terra wrote: > Alright, do what you will. Whatever floats your boat.. > > On Fri, Aug 19, 2011 at 5:12 AM, Matt Schinckel wrote: >> >> On Friday, August 19, 2011 12:07:44 PM UTC+9:30, Andre Terra (airstrike) >> wrote: >>> >>> Until you install some third par

Re: Strange behavior in model.save()

2011-08-19 Thread Yaşar Arabacı
I don't quite understand what you did there, but, it seems to me it is the same thing with your initial post. ref = getattr(self, f.name) -> you are getting a field here, this field is a empty descriptor, doesn't hold any data yet. ref.full_save(*args,*kwargs) -> you populated your field with data

Re: Initialization code that should only run under a web server

2011-08-19 Thread bruno desthuilliers
On 19 août, 16:15, Boaz Leskes wrote: > Hi, > > I have some computationally intensive initialization logic that > should run when a new process is started up by the web server. Following > advice on the web, I've imported the module with the initialization > code from settings.py, which works perf

Re: Django Not Populating AutoField

2011-08-19 Thread Lee
Landy - thanks for that idea. Am I correct in understanding that setting a field to AutoField has no effect on save_model, and simply causes dbsync to add the sequence/nextval to the Postgres table? If so that is my problem, because I want to have one database schema that works across different DBM

Re: Dynamic Forms with Varying init Arguments

2011-08-19 Thread wayne
On Aug 19, 12:41 pm, SixDegrees wrote: > The parameter in question is a primary key that is used to generate a series > of fields within the form. It is passed to the form __init__ routine, and > can vary from one form to another. So, given a formset, I want to tell the > formset "This is the para

Re: Djangonaut is looking for a job

2011-08-19 Thread Andre Terra
http://djangogigs.com/ https://www.djangoproject.com/rss/community/jobs/ 2011/8/19 Eugeny Belykh > hi)) > i think yes,we should keep trying > > > 2011/8/17 枯藤天涯 > >> hello,I am from China。And I am looking a job about python/django .Just >> same as you .Remote (telecommuting) only.Can we find t

Re: Django Not Populating AutoField

2011-08-19 Thread Landy Chapman
Did you create the table using django? Can you post the table definition in postgresql? If you still have an empty database, you could try dropping the id column and do a django dbsync otherwise you may have to create a sequence and apply it to the id field. Something along the lines of: creat

Re: Dynamic Forms with Varying init Arguments

2011-08-19 Thread SixDegrees
The parameter in question is a primary key that is used to generate a series of fields within the form. It is passed to the form __init__ routine, and can vary from one form to another. So, given a formset, I want to tell the formset "This is the parameter you should use when creating the next for

Re: Djangonaut is looking for a job

2011-08-19 Thread Eugeny Belykh
hi)) i think yes,we should keep trying 2011/8/17 枯藤天涯 > hello,I am from China。And I am looking a job about python/django .Just > same as you .Remote (telecommuting) only.Can we find the job like > this? > > 2011/8/5 Eugeny Belykh : > > Hi everybody.I am Django newbee based in Russia. I am look

Re: Django Not Populating AutoField

2011-08-19 Thread Lee
<> Did so -- no effect. I even disabled my overridden save_model so I'm back to out-of-the-box Admin setup -- no effect. This is with Postgres and the psycopg2 driver. Is no one else seeing this problem? On Aug 18, 5:32 pm, Shawn Milochik wrote: > As defined your id field doesn't differ from Dja

Re: Dynamic Forms with Varying init Arguments

2011-08-19 Thread wayne
On Aug 19, 10:44 am, SixDegrees wrote: > I'm using formsets to implement a dynamic form as > describedhttp://www.mancoosi.org/~abate/dynamic-forms-with-djangohere . > However, the > forms created by the formset want a parameter passed that determines the > contents of the form during initializat

Re: Getting ForeignKey not to CASCADE, SET NULL not working (postgresql)

2011-08-19 Thread mike
thanks for the links. I did come across those issues as well. But the main issue is that no SET NULL contraint is being set on the database ... Django does do it, but if someone deletes an item using the cli, the database will not do the right thing since the sql being generated ignores the SET N

Re: Getting ForeignKey not to CASCADE, SET NULL not working (postgresql)

2011-08-19 Thread Landy Chapman
Have a look: - http://old.nabble.com/Should-postgresql-cascade-after-truncate-td31886534.html - https://code.djangoproject.com/ticket/11665 http://groups.google.com/group/django-developers/browse_thread/thread/27fe52b8bd0ca105/49d5058a1594a428 -- You received this message because you are subs

Re: Django reloader fails to watch all the project files

2011-08-19 Thread Bill Freeman
Does your urls.py in the app in question import the view, or are you just referring to the view functions with strings? I'm not sure whether views.py is imported before the first time one of the urls is triggered in this case, but it would be a cheap check to add the import. On Thu, Aug 18, 2011

Dynamic Forms with Varying init Arguments

2011-08-19 Thread SixDegrees
I'm using formsets to implement a dynamic form as described http://www.mancoosi.org/~abate/dynamic-forms-with-django here . However, the forms created by the formset want a parameter passed that determines the contents of the form during initialization. This parameter can be passed back through a

Re: modelForm has no _default_manager

2011-08-19 Thread Guillaume DE BURE
Thanks, I overlooked the documentation... Will check this! Guillaume Le 19 août 2011 14:49, "Daniel Roseman" a écrit : > On Friday, 19 August 2011 11:15:53 UTC+1, gdebure wrote: >> >> Hi Everyone, >> >> I've been discovering Django for a few weeks, and love it so far :) >> However I am facing an

Using annotate() in a custom model manager

2011-08-19 Thread LaundroMat
Hi - I have these models; with one custom manager. class OrderByHighestScoreManager(models.Manager): def get_query_set(self, *args, **kwargs): qs = super(OrderByHighestValidationsManager, self).get_query_set(*args, **kwargs) return qs.annotate(score=Count('votes__id'),).order_

Re: Strange behavior in model.save()

2011-08-19 Thread David Jacquet
Thanks Yaşar and Jani for your fast replies! I understand that normally one would assign in the reverse order. However I do not understand exactly what happens when I do meeting.place = meeting.place never in my programming experience have I seen an example when x=x really does something. Isn't t

Re: Initialization code that should only run under a web server

2011-08-19 Thread Yaşar Arabacı
I didn't try this but might work. You can create a second manage.py called for example manage2.py file with following contents: #!/usr/bin/env python from django.core.management import execute_manager import imp try: imp.find_module('alternative_settings') # Assumed to be in the same directory.

Initialization code that should only run under a web server

2011-08-19 Thread Boaz Leskes
Hi, I have some computationally intensive initialization logic that should run when a new process is started up by the web server. Following advice on the web, I've imported the module with the initialization code from settings.py, which works perfectly as advertised. However, it has one side effe

Getting ForeignKey not to CASCADE, SET NULL not working (postgresql)

2011-08-19 Thread mike
I can get the set null on a foreign key to work. in my model I have this: leaguteTypeId = models.ForeignKey(LeagueType,null=True, db_column='leaguetype', on_delete=models.SET_NULL) This is what is postgresql dumps: ALTER TABLE ONLY league ADD CONSTRAINT league_leaguetype_fkey FOREIGN KEY (l

Re: Best approach to handling different types of Users

2011-08-19 Thread Andre Terra
Alright, do what you will. Whatever floats your boat.. On Fri, Aug 19, 2011 at 5:12 AM, Matt Schinckel wrote: > > On Friday, August 19, 2011 12:07:44 PM UTC+9:30, Andre Terra (airstrike) > wrote: >> >> Until you install some third party app that accesses >> User.objects.all() and then suddenly n

Re: modelForm has no _default_manager

2011-08-19 Thread Daniel Roseman
On Friday, 19 August 2011 11:15:53 UTC+1, gdebure wrote: > > Hi Everyone, > > I've been discovering Django for a few weeks, and love it so far :) > However I am facing an issue with a modelForm. As I couldn't find my > answer through googling, I thought you might be able to help... > > == conte

Re: Strange behavior in model.save()

2011-08-19 Thread Jani Tiainen
On 08/19/2011 03:15 PM, Jacco wrote: I am having great difficulties in saving nested models in an easy way. #Two (almost) identical functions: def test1(): place = Place(where='Paris') place is not saved, thus it does not have a primary key (id) meeting = Meeting(place=place, when

Re: Strange behavior in model.save()

2011-08-19 Thread Yaşar Arabacı
And your second function works because when you set meeting.place = meeting.place, unsaved place object gets changed with saved place object :) Nice catch though. 19 Ağustos 2011 15:28 tarihinde Yaşar Arabacı yazdı: > It is because you are creating meeting object, before saving "place" in db. >

Re: Strange behavior in model.save()

2011-08-19 Thread Yaşar Arabacı
It is because you are creating meeting object, before saving "place" in db. So place object doesn't have any id yet. So test 1 should be: place = Place(where='Paris') place.save() meeting = Meeting(place=place, when='2011-01-01') meeting.save() return meeting 2011/8/19 Jacco >

Re: Getting and modifying url parameters in template: howto?

2011-08-19 Thread Yaşar Arabacı
You can either send required information from your view to your template, or do some javascript on the browser side. 2011/8/19 samuele.mattiuzzo > Yeah, i was thinking about that... > > A template tag like {% my_url %} > > could be something like that... > > On Aug 18, 6:36 pm, Andre Terra wr

Strange behavior in model.save()

2011-08-19 Thread Jacco
I am having great difficulties in saving nested models in an easy way. Consider the following Example : -- class Place(models.Model): where = models.Ch

modelForm has no _default_manager

2011-08-19 Thread gdebure
Hi Everyone, I've been discovering Django for a few weeks, and love it so far :) However I am facing an issue with a modelForm. As I couldn't find my answer through googling, I thought you might be able to help... == context == I have an object (called "Domain") that has an "owner" attribute that

Assign a variable from a template in a "global" way?

2011-08-19 Thread Forbairt
Hi All, I'm using the code from http://www.soyoucode.com/2011/set-variable-django-template from django import template register = template.Library() class SetVarNode(template.Node): def __init__(self, var_name, var_value): self.var_name = var_name self.var_value = var_valu

Re: Getting and modifying url parameters in template: howto?

2011-08-19 Thread samuele.mattiuzzo
Yeah, i was thinking about that... A template tag like {% my_url %} could be something like that... On Aug 18, 6:36 pm, Andre Terra wrote: > Assuming I understood what you're trying to do, why not write a template tag > (more specifically, an inclusion tag)? > > Cheers, > AT > > On Thu, Aug 1

Re: Django admin site and DEBUG flag.

2011-08-19 Thread william ratcliff
Actually, you might want to just use the following: http://betterthangrep.com/ to search through the entire project--this program has saved me a lot of time! William On Fri, Aug 19, 2011 at 4:36 AM, Reinout van Rees wrote: > On 19-08-11 10:27, KC LEE wrote: > >> urlpatterns = patterns('', >> >>

How to make pydev suport django specific syntax?

2011-08-19 Thread smith jack
for example, django have some dynamic mechanism, the code can be processed wel by django, but pydev will just simply show some error message, how to make pydev deal with such dynamics? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to t

Re: Django admin site and DEBUG flag.

2011-08-19 Thread Reinout van Rees
On 19-08-11 10:27, KC LEE wrote: urlpatterns = patterns('', (r'^$', 'accounts.views.front_page'), url(r'social/', include('social_auth.urls')), (r'^admin/', include(admin.site.urls)), (r'^regions/', include('region.urls')), (r'^messages/', include('pimfy_messages.urls

Re: 'dict' object has no attribute 'META'

2011-08-19 Thread MikeKJ
Thanks guys! yeah the request parameter was missing, so much for parallel monitor reading! All I can say is that I write code better now, thanks again MJ The first parameter to RequestContext should always be the request, not the context dict. I don't think that has ever been different - see

Re: Django admin site and DEBUG flag.

2011-08-19 Thread KC LEE
My problem is identical to this, https://groups.google.com/group/django-users/browse_thread/thread/62af38b39713f5e7/279df4fba31fd292 On Aug 19, 5:27 pm, KC LEE wrote: > My urls.py looks like this, > > # -*- coding: utf-8 -*- > > from django.conf.urls.defaults import * > from django.conf import s

Re: Django admin site and DEBUG flag.

2011-08-19 Thread KC LEE
My urls.py looks like this, # -*- coding: utf-8 -*- from django.conf.urls.defaults import * from django.conf import settings from django.views.generic.simple import direct_to_template from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^$', 'accounts.views.f

Re: Best approach to handling different types of Users

2011-08-19 Thread Matt Schinckel
On Friday, August 19, 2011 12:07:44 PM UTC+9:30, Andre Terra (airstrike) wrote: > > Until you install some third party app that accesses > User.objects.all() and then suddenly nothing works as it's supposed > to. > > Why wouldn't it? The User subclasses will still appear in the User.objects.all(

Re: Using os.fork() in a Django view

2011-08-19 Thread Kevin
Thank you very much for your suggestions about using Celery. I'll definitely look into this one. Originally I was trying to avoid using os.fork(), but was unsure what to use. I will also look into the uWSGI information provided as well. Overall I would prefer to make the entire system modular,

Re: Django admin site and DEBUG flag.

2011-08-19 Thread Reinout van Rees
On 19-08-11 05:28, KC LEE wrote: When I set DEBUG flag true, Django admin site works fine. But when I change it to false, it throws me the page not found in Django admin site (except main page of admin site, Groups page, and Users page) This sounds like your urls.py has an "if settings.DEBUG:"

Re: problem with a graph image in template

2011-08-19 Thread Reinout van Rees
On 19-08-11 04:03, smartaz wrote: I think the error is in image.png GET, a python syntax error but I can not think where (I do not know how to retrieve the trace of a 500 error in django, I installed django debug toolbar) it seems that python can not write the file with the image ..the content ty

Re: Using os.fork() in a Django view

2011-08-19 Thread Roberto De Ioris
Il giorno 19/ago/2011, alle ore 08:46, Kevin ha scritto: > Hello everyone, > > > Here's the code I will be needing to run in a os.fork(): > from django.core.management import setup_environ, call_command > import settings > setup_environ(settings) > call_command('', **kwargs) > > So this would

Re: Using os.fork() in a Django view

2011-08-19 Thread Russell Keith-Magee
On Fri, Aug 19, 2011 at 2:46 PM, Kevin wrote: > Hello everyone, > >  Firstly, I've been using Django for quiet sometime now and have > created a few projects and many of my websites run it.  I am wanting > to take my Django management to the next level, and need to use the > os.fork() function, he