Forms: Set default value

2009-07-14 Thread Wiiboy

Hi,
I'm defining a form model, and I have a choice field.  I have the
values in order, and I want one value (in the middle of the values in
order) to be the default.  How do I do that?

Passing initial= anything doesn't work.
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Deployment dilemma

2009-07-14 Thread Rama Vadakattu

i will look into pip and zc.buildout thanks for your suggestions.

On Jul 14, 9:31 pm, Lakshman Prasad  wrote:
> zc.buildout  enables reproducible
> build and deployments. pip offers a simple solution by the way of freeze and
> requirements file at server.
>
>
>
> On Tue, Jul 14, 2009 at 9:33 PM, Alex Gaynor  wrote:
>
> > On Tue, Jul 14, 2009 at 10:46 AM, Rama Vadakattu  > > wrote:
>
> >> I have a django project with N number of dependencies to other
> >> packages.
> >> Now i want to deploy the project on production server?
>
> >> As of now iam doing this.
> >> 1.Move the django project to production server.
> >> 2.install the dependencies on production server similar to that of the
> >> way i have done on local system.
>
> >> Is it the right approach?
> >> i feel reinstalling dependencies again on production server is
> >> tedious.
>
> >> i would like to know how everyone  is dealing with the above problem.
>
> >> --rama
>
> > Take a look at PIP and it's requirement file system, which I think for
> > python packages is a good solution.  If you have OS level dependencies (such
> > as the stuff GIS relies on) you'll probably need to see what tools your
> > packages manager offers.
> > Alex
>
> > --
> > "I disapprove of what you say, but I will defend to the death your right to
> > say it." -- Voltaire
> > "The people's good is the highest law." -- Cicero
> > "Code can always be simpler than you think, but never as simple as you
> > want" -- Me
>
> --
> Regards,
> Lakshman
> becomingguru.com
> lakshmanprasad.com
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Lost Comments moving from test to production

2009-07-14 Thread goodwinb

I have a project that uses django.contrib.comments wrapped by
mptt_comments.  It was working fine on my test server.  In moving the
project to a production server I have missed a setting somewhere and
lost Comments.

When I hit the page that will contain comments I get "Caught an
exception while rendering: operator does not exist: text = integer
LINE 1: ...ent_ptr_id") WHERE ("django_comments"."object_pk" = 1  AND
T...".

When I go to /admin I see mptt_comments but not comments.  When I
start the db I see the comments table being created.  My settings.py
includes INSTALLED_APPS = ( ... 'django.contrib.comments',...).  My
urls.py contains '#(r'^comments/', include
('django.contrib.comments.urls')),'  I am using Python 2.6 and Django
1.1 beta.

Does anyone have any kind hints to look to see where I have gone wrong
in the settings?
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: url as folder path possible?

2009-07-14 Thread theiviaxx

awesome, thats exactly what i needed.  im still trying to figure out
regex stuff.

Thank you!

On Jul 14, 1:16 am, Eugene Mirotin  wrote:
> The problem is still unclear.
> Do you want to handle the path example.com/some/path/ and route it to
> some view that would get the 'some/path' as argument?
> If so,
> * write the url conf like r'^([\w_\/]+)/$', handle_path
> * write the handle_path(request, path) view
> * in view split the pass by slashes
> * determine the object based on the path (using some getattr calls on
> modules or objects)
> * call the desired methods on the obtained object
>
> On Jul 14, 4:22 am,theiviaxx wrote:
>
>
>
> > Sorry i didnt explain very well.  The folder objects are django
> > objects, not file system paths
>
> > On Jul 13, 6:19 pm, Almir Karic  wrote:
>
> > > For real world deployment you should use your web server to do that.
> > > For apache that would be an Alias (and make sure the Alias get's to be
> > > served before everything is passed to django).
>
> > > For development purposes you should have a look 
> > > athttp://docs.djangoproject.com/en/dev/howto/static-files/
>
> > > python/django hacker & sys 
> > > adminhttp://almirkaric.com://twitter.com/redduck666
>
> > > On Mon, Jul 13, 2009 at 5:39 PM,TheIvIaxx wrote:
>
> > > > I tried searching but didnt really find much.
>
> > > > Is there a way to set up a url conf to get a url of a folder path?
> > > > Basically i have a site that has folder-ish objects that contain
> > > > stuff.  However i cannot seem to find a way to get a url pattern to
> > > > work.  how would i get:
>
> > > >http://example.com/path/to/folder
>
> > > > to work?
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



syncdb and #10706

2009-07-14 Thread Kenneth Gonsalves

hi,

I find that syncdb fails silently to create tables for apps that give the 
misleading error message described in #10706. I cannot find a ticket for that. 
Should one be filed, or have I missed it?
-- 
regards
kg
http://lawgon.livejournal.com

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Creating Model with ManyToMany relationship from PyAMF & Flex

2009-07-14 Thread Jesse Warden
Nevermind, found this:
http://www.djangoproject.com/documentation/models/many_to_many/

And got it working.  woo WOOO!!!

On Tue, Jul 14, 2009 at 2:28 PM, Jesse Warden wrote:

> n00b here.  I'd like to create a complex Model from a Flex Object
> (basically decoded JSON).  I've created a Model successfully already, but am
> unsure how to do this with the multiple Models that have ManyToMany
> relationships with each other.
> This works:
>
> def create_power(request, powerObj):
> try:
> p = Power()
>  p.name = powerObj.name
> p.level = powerObj.level
>  p.save()
> ...
>
>
> However, I'd like to create the other models too.  Psuedo structure:
>
> class PowerSource(models.Model):
> label = models.CharField(max_length=200)
> power = models.ManyToManyField(Power)
>
> What would the code look like... maybe like this?
>
> ps = PowerSource()
> ps.label = powerObj.powerSource.label;
> ps.power = p;
> ps.save()
>
> Thanks if you can help!
>

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: dict objects are unhashable in admin... in this a bug?

2009-07-14 Thread Some Guy

admin.py is here --> http://pastebin.com/m23760293 ... stack trace is
here -> http://pastebin.com/m971fc89

It's fairly vanilla. I also had a similar error from the {%doctools%}
tag on change_list page.  SInce it was not essential I changed it to a
comment tag.  Things work ok after that, but I need the ability to
edit users :-)

Right now I'm using 1.1 beta 1 django, apache2, and sqlite3

I saw something similar in trac but it was closed with "works for me"


On Jul 14, 12:41 pm, Alex Gaynor  wrote:
> On Tue, Jul 14, 2009 at 2:28 PM, Some Guy  wrote:
>
> > Hi Group,
> > I'm using svn version of django and SQLite3 on linux. I set up a basic
> > admin user and when I try to access the edit page I get the
> > "TemplateSyntaxError at /admin/auth/user/1/
> > Caught an exception while rendering: dict objects are unhashable"
>
> > Is this a bug? how far back should I downgrade to get around it?
>
> > error screen paste below...
>
> > 
> > 9                 {% if field.is_checkbox %}
> > 10                    {{ field.field }}{{ field.label_tag }}
> > 11                {% else %}
> > 12                    {{ field.label_tag }}{{ field.field }} <<--- This
> > {{field.field}} is highlighted red in the debug screen!
> > 13                {% endif %}
> > 14                {% if field.field.field.help_text %}
> > {{ field.field.field.help_text|safe }}{% endif %}
> > 15            
>
> Can you paste the admin.py file or other code for the app that's giving you
> this error?
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." -- Voltaire
> "The people's good is the highest law." -- Cicero
> "Code can always be simpler than you think, but never as simple as you want"
> -- Me
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: I need to get psycopg2 installed on Mac OS X 10.5

2009-07-14 Thread Kevin

Thanks a lot Juan!  It works fine on my machine.  Would you be able to
share your compilation steps?

On Jul 14, 7:32 am, Juan Pablo Romero Méndez 
wrote:
> I don't know if it will run in your machine, but here is one compiled
> for Python2.5, MacOS X 10.5.7, and PostgreSQL 8.3.
>
> Regards,
>
>   Juan Pablo
>
> 2009/7/14 Kevin :
>
>
>
>
>
> > I need to get psycopg2 installed on Mac OS X 10.5
>
> > I have read every install guide I could find and I still do not have
> > it working. I have developer tools installed. I am running MacPython
> > 2.6.2 and PostgreSQL 8.4 downloaded 
> > fromhttp://www.enterprisedb.com/products/pgdownload.do
>
> > On my production machine (Debian) I did a simple atp-get and it
> > worked. Why is it so much harder on Mac OS X?  I am very near ripping
> > my hair out because I have wasted too much time and I do not
> > understand why psycopg2 does not work on my machine.
>
> > Below are my notes from three attempts to install psycopg2.  I have
> > read other threads that suggest installing Python, PostgreSQL, and
> > psycopg2 from MacPorts.  I do not want to use MacPorts.  I do not see
> > why I need to use a completely different installation of Python to use
> > a simple database driver.
>
> > For my first attempt I followed the instructions listed here:
> >http://jasonism.org/weblog/2008/nov/06/getting-psycopg2-work-mac-os-x...
> > It told me to add these lines to setup.cfg:
>
> > include_dirs=/Library/PostgreSQL/8.3/include
> > library_dirs=/Library/PostgreSQL/8.3/lib
>
> > I then ran python setup.py build and got this error:
>
> > $ python setup.py build
> > running build
> > running build_py
> > creating build
> > creating build/lib.macosx-10.3-fat-2.6
> > creating build/lib.macosx-10.3-fat-2.6/psycopg2
> > copying lib/__init__.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
> > copying lib/errorcodes.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
> > copying lib/extensions.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
> > copying lib/extras.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
> > copying lib/pool.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
> > copying lib/psycopg1.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
> > copying lib/tz.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
> > running build_ext
> > error: No such file or directory
>
> > ===
>
> > For my next attempt I followed the instructions listed here:
> >http://blog.jonypawks.net/2008/06/20/installing-psycopg2-on-os-x/
> > It told me to run this:
>
> > PATH=$PATH:/Library/PostgresPlus/8.3/bin/ sudo easy_install psycopg2
>
> > This resulted in this error: (I substituted "8.4" for "8.3" because my
> > version of PostgreSQL is newer)
>
> > $ PATH=$PATH:/Library/PostgreSQL/8.4/bin/ sudo easy_install psycopg2
> > Password:
> > Searching for psycopg2
> > Readinghttp://pypi.python.org/simple/psycopg2/
> > Readinghttp://initd.org/projects/psycopg2
> > Readinghttp://initd.org/pub/software/psycopg/
> > Best match: psycopg2 2.0.11
> > Downloadinghttp://initd.org/pub/software/psycopg/psycopg2-2.0.11.tar.gz
> > Processing psycopg2-2.0.11.tar.gz
> > Running psycopg2-2.0.11/setup.py -q bdist_egg --dist-dir /tmp/
> > easy_install-dUXtsI/psycopg2-2.0.11/egg-dist-tmp-1008XV
> > warning: no files found matching '*.html' under directory 'doc'
> > warning: no files found matching 'MANIFEST'
> > /usr/libexec/gcc/i686-apple-darwin9/4.0.1/as: assembler (/usr/bin/../
> > libexec/gcc/darwin/i386/as or /usr/bin/../local/libexec/gcc/darwin/
> > i386/as) for architecture i386 not installed
> > /usr/libexec/gcc/powerpc-apple-darwin9/4.0.1/as: assembler (/usr/
> > bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/
> > darwin/ppc/as) for architecture ppc not installed
> > Installed assemblers are:
> > /usr/bin/../libexec/gcc/darwin/ppc64/as for architecture ppc64
> > /usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
> > Installed assemblers are:
> > /usr/bin/../libexec/gcc/darwin/ppc64/as for architecture ppc64
> > /usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
> > lipo: can't open input file: /var/tmp//ccSK6sd7.out (No such file or
> > directory)
> > error: Setup script exited with error: command 'gcc' failed with exit
> > status 1
> > Exception TypeError: TypeError("'NoneType' object is not callable",)
> > in  > 0x9e3910>> ignored
> > Exception TypeError: TypeError("'NoneType' object is not callable",)
> > in  > 0x9e3970>> ignored
>
> > ===
>
> > For my third attempt I installed the binary of psycopg2 from
> >http://pythonmac.org/packages/py25-fat/index.html
> > I thought it worked, but when I tried to import the module in the
> > interpreter I got this error:
>
>  import psycopg2
> > Traceback (most recent call last):
> >  File "", line 1, in 
> >  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
> > 

ANN: RuPy '09 Conference

2009-07-14 Thread Jakub P. Nowak

RuPy 2009 :: Strongly Dynamic Conference

Poznan, Poland
November 7-8, 2009

:: Call for speakers

RuPy is a conference about dynamically typed programming languages.
Held for the first time in April 2007 it gathered enthusiasts
from Poland and other countries.

The idea behind the conference is to liven up the
community and make these technologies more popular in Europe.

The first conference was a middle-sized one but came out as
a huge success. We believe it was a great experience for both
attendees and speakers.

RuPy 2009 committee is looking for speakers willing to present
a Python, Ruby, Groovy or any other related subject.
If you have an interesting talk in mind go ahead and submit a
talk proposal. The talk proposal should include a talk title,
brief introduction and your short resume/biography.

To our invited speakers we offer free accommodation, full
board and possibility to interact with a very lively IT community.
You are also free to participate in all the extra events -
'Geek party' always turns out great!

You can also support us by linking to our site and informing
all your friends about the event and the possibility to submit
a talk proposal.

Potential speakers should submit an abstract using the following
form:

https://spreadsheets.google.com/viewform?formkey=dEFEYndsQWR2TGFzRFpzcU9IbFlCT2c6MA..

by September 30th, 2009 for consideration.

If you have any special presentation needs, let us know.

For more details check our site:
http://www.rupy.eu

Best regards,
--
Jakub P. Nowak
RuPy Committee

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Converting django models to google app engine models

2009-07-14 Thread Matteo Rosati
Hello friend,
maybe you can consider using the Goole App Engine helper for Django.

http://code.google.com/p/google-app-engine-django/

when you download the necessary files, read the README file and read how to
deploy a pre existing django application in google AE without modifying your
files (except for the settings); this is explained in "Installing the helper
into an existing project" in the README file!

i hope this helps you!

bye,
Matteo

2009/7/14 Vishwajeet 

>
> Hi All,
>
> I am planning to host my django application on google app engine; I
> have completed the application using django but now when I decided to
> host it on google app engine I need to changed models and all it
> reference to app engines framework; I have googled alot but have not
> found much information on migrating models and how to go about it. I
> found nifty examples but that does not cover the all
> If any of you out there have any experience in same I would appreciate
> if you can share the same.
> >
>


-- 
Matteo Rosati
Web: http://wwwstud.dsi.unive.it/~mrosati
PGP: http://wwwstud.dsi.unive.it/~mrosati/pgp.html
GNU/Linux registered user #398557

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Basic AJAX (was: Re: multi applications)

2009-07-14 Thread sjtirtha
Hi,

thank you for the explanation. I'll look into it.
I found also an ajax lib for Django, it is DAJAX.
Steve

On Tue, Jul 14, 2009 at 10:09 PM, Shawn Milochik wrote:

>
>
> On Jul 14, 2009, at 3:43 PM, sjtirtha wrote:
>
> > Thank you for the explanation.
> > This helps me very much.
> >
> > You mentions about handling the smaller apps on the page with AJAX.
> > Is there any basic functionality to do this from Django Framework?
> > Or do you have any ajax lib/framework as preference?
> >
> > Steve
> 
>
> Use jQuery -- it'll automate most of it.
>
> Here are two simple samples. Both are in the $(document).ready()
> function. Once you use jQuery for about three minutes, you'll know
> what that is.
>
>This does a GET request to get a user's current balance.
>It then writes the balance (returned as JSON by the view)
>into the HTML div with the id current_balance.
>
>$.get("/balance_json/{{ch.slug}}", {}, function (data){
>$('#current_balance').html("$" + data.balance);
>}, 'json');
>
>
>This does a POST to submit a form to send an SMS message. The view
> also returns
>JSON in this case, (created from a Python dictionary), which will
> have a key of 'success'
>with a value of the success message, or a key of 'failure' with an
> error message in it.
>
> $("#sms_form").submit(function(event){
> event.preventDefault();  // stop the form from submitting and
> refreshing the page
> var data = $("#sms_form").serialize()
>
> // now send the data to the server via AJAX
> $.post("/patient/{{ch.slug}}/sms/", data, function(resp){
> if(resp.success) {
> $("#messages").html(" class='success'>" + resp.success + "");
> $("#success-message").animate({ backgroundColor:
> "#E6EFC2" }, 2000);
> update_activity();
> } else if (resp.fail) {
> $("#messages").html(" class='fail'>" + resp.fail + "");
> $("#fail-message").animate({ backgroundColor:
> "#fbe3e4" }, 2000);
> }
> }, "json");
> });
>
> I don't know if there are are super-special Django tools to do AJAX,
> but as it's JavaScript and Django's Python, I doubt it.
>
> The most useful things in Django are simplejson and safestring (both
> in django.utils). You'll need simplejson to easily dump a dictionary
> into a JSON string to pass back to JavaScript, and you'll need
> safestring to "mark_safe" JSON strings you're going to pass via the
> context to be rendered within the templates. Otherwise they'll be
> escaped automatically for your protection.
>
> Shawn
>
> >
>

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Slug Field

2009-07-14 Thread Alex Gaynor
On Tue, Jul 14, 2009 at 3:56 PM, Sonal Breed  wrote:

>
> Hi all,
>
> I am little confused about the working of slug fields.
> I have a model:
> class Story(models.Model):
>slug = models.SlugField(unique_for_date = 'date_created',
>help_text="suggested values automatically generated
> from title"
>title = models.CharField(max_length=50, blank=False)
>story = models.CharField(max_length=500, blank=False)
>
> In admin.py
> class StoryAdmin(admin.ModelAdmin):
>prepopulated_fields = {"slug": ("title",)}
>
> admin.site.register(Story, StoryAdmin)
>
> Now, should I expect the slug field to get automatically populated
> with the value of title, each time an entry is saved. What is the
> expected behaviour of slug? Currently, I cannot see the value of title
> in slug field in admin site.
>
> Can anybody throw some light on this?
>
> Thanks in advance,
> Sonal.
> >
>
The slug will only be automatically populated when you are adding records
from the admin.  Any other method of entry will not have the slug field
automatically populated.
Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you want"
-- Me

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error: ce is not defined

2009-07-14 Thread Sonal Breed


Well Joost,
After I made TINYMCE_COMPRESSOR as False, I could get tinymce toolbar.
However, the style dropdown is showing empty, and there are couple of
other things I would like to have, like spell checker and color.
Have to go through tinymce docs, do u have any tips?

Thanks in advance,
Sonal.

On Jul 14, 2:13 am, Joost Cassee  wrote:
> On Jul 14, 1:53 am,SonalBreed  wrote:
>
> > I am trying to add django-tinymce-1.5 in my application.
> > I downloaded tinymce_3_2_5 and installed it using sudo python setup.py
> > install.
>
> > In my settings I have following:
> > [...]
> > INYMCE_JS_URL = MEDIA_URL + 'js/tiny_mce/tiny_mce.js'
> > TINYMCE_JS_ROOT = MEDIA_ROOT + 'js/tiny_mce'
>
> I'm assuming that these paths are correct.
>
> > TINYMCE_COMPRESSOR = True
>
> You could disable the compressor to aid debugging.
>
> Everything looks okay at first glance.
>
> > But i do not get the tinymce toolbar, in Firebug I get following
> > tinymce is not defined at
>
> > start : function() {
> >  var t = this, each = tinymce.each, s = t.settings, ln =
> > s.languages.split(',');
> > This is compressor, i believe.
>
> It seems the TinyMCE Javascript has not been rendered correctly.
>
> Maybe the compressor could not find all files?
>
> > Can anybody tell me what is it that I am doing wrong or is there
> > anything that I am missing.
>
> Could you show the generated Javascript?
>
> Regards,
>
> Joost
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Slug Field

2009-07-14 Thread Sonal Breed

Hi all,

I am little confused about the working of slug fields.
I have a model:
class Story(models.Model):
slug = models.SlugField(unique_for_date = 'date_created',
help_text="suggested values automatically generated
from title"
title = models.CharField(max_length=50, blank=False)
story = models.CharField(max_length=500, blank=False)

In admin.py
class StoryAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("title",)}

admin.site.register(Story, StoryAdmin)

Now, should I expect the slug field to get automatically populated
with the value of title, each time an entry is saved. What is the
expected behaviour of slug? Currently, I cannot see the value of title
in slug field in admin site.

Can anybody throw some light on this?

Thanks in advance,
Sonal.
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Question regarding post_save signal and ManyToMany field objects

2009-07-14 Thread Ryan K

Alex,

So I have my Menus that contain links and a Link can be in multiple
Menus. Are you saying make an explicit model like:

class MenuLinks(models.Model):
menu = models.ForeignKey(Menu)
link = models. ForeignKey(Link)

?

Basically what I am doing is making an enhanced flatpages app called
staticpages. I want my client to have full control over the page's
content, menus associated with a page as well as links in the menu..
Here is my signals.py:

http://pastebin.com/m3c333dd

If I modify it to use the above table and connect to its post_save
signal, is my solution worth it? I use signals to generate an XHTML
menu and cache it in my database. I do this in a thread. Someone said
don't use threads. What is the consensus on that?

Cheers,
Ryan

On Jul 14, 10:43 am, Alex Gaynor  wrote:
> On Tue, Jul 14, 2009 at 9:35 AM, Russell Keith-Magee 
>
>
>
>
> > wrote:
>
> > On Tue, Jul 14, 2009 at 6:27 PM, Ryan K wrote:
>
> > > Yea...it would be so elegant too! Here is a "bug" filing:
> > >http://code.djangoproject.com/ticket/5390. It's been open for two
> > > years
>
> > A little history may help explain why this has been open for so long.
>
> > Historically (i.e., when dinosaurs roamed the Django source code)
> > signals were _very_ expensive - even signals that had no listeners. As
> > a result, there was a lot of resistance to adding new signals. Given
> > the performance cost, the decision was made to live without m2m
> > signals.
>
> > Just prior to v1.0, the signal framework was updated, which made
> > signals much faster. However, in an attempt to actually hit the
> > deadline for getting 1.0 out the door, adding new signals wasn't on
> > the plan.
>
> > Adding new signals was discussed as a possible feature for v1.1 (see
> > the features page [1]); however, nobody took charge of getting it
> > done, and other development priorities took over. The feature deadline
> > arrived before anyone got around to implementing (and integrating) the
> > change.
>
> > When the v1.2 development cycle starts, I'm sure this will be back on
> > the schedule again.
>
> > [1]http://code.djangoproject.com/wiki/Version1.1Features
>
> > Yours,
> > Russ Magee %-)
>
> The best way now to get this feature is to use an intermediary model which
> obviously get's its own signals.  Additionally I've been working on
> refactoring m2ms to always use an intermediary model, thus signals would
> always be sent.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." -- Voltaire
> "The people's good is the highest law." -- Cicero
> "Code can always be simpler than you think, but never as simple as you want"
> -- Me
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Basic AJAX (was: Re: multi applications)

2009-07-14 Thread Shawn Milochik


On Jul 14, 2009, at 3:43 PM, sjtirtha wrote:

> Thank you for the explanation.
> This helps me very much.
>
> You mentions about handling the smaller apps on the page with AJAX.  
> Is there any basic functionality to do this from Django Framework?
> Or do you have any ajax lib/framework as preference?
>
> Steve


Use jQuery -- it'll automate most of it.

Here are two simple samples. Both are in the $(document).ready()  
function. Once you use jQuery for about three minutes, you'll know  
what that is.

This does a GET request to get a user's current balance.
It then writes the balance (returned as JSON by the view)
into the HTML div with the id current_balance.

$.get("/balance_json/{{ch.slug}}", {}, function (data){
$('#current_balance').html("$" + data.balance);
}, 'json');


This does a POST to submit a form to send an SMS message. The view  
also returns
JSON in this case, (created from a Python dictionary), which will  
have a key of 'success'
with a value of the success message, or a key of 'failure' with an  
error message in it.

 $("#sms_form").submit(function(event){
 event.preventDefault();  // stop the form from submitting and  
refreshing the page
 var data = $("#sms_form").serialize()

 // now send the data to the server via AJAX
 $.post("/patient/{{ch.slug}}/sms/", data, function(resp){
 if(resp.success) {
 $("#messages").html("" + resp.success + "");
 $("#success-message").animate({ backgroundColor:  
"#E6EFC2" }, 2000);
 update_activity();
 } else if (resp.fail) {
 $("#messages").html("" + resp.fail + "");
 $("#fail-message").animate({ backgroundColor:  
"#fbe3e4" }, 2000);
 }
 }, "json");
 });

I don't know if there are are super-special Django tools to do AJAX,  
but as it's JavaScript and Django's Python, I doubt it.

The most useful things in Django are simplejson and safestring (both  
in django.utils). You'll need simplejson to easily dump a dictionary  
into a JSON string to pass back to JavaScript, and you'll need  
safestring to "mark_safe" JSON strings you're going to pass via the  
context to be rendered within the templates. Otherwise they'll be  
escaped automatically for your protection.

Shawn

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: dict objects are unhashable in admin... in this a bug?

2009-07-14 Thread Alex Gaynor
On Tue, Jul 14, 2009 at 2:28 PM, Some Guy  wrote:

>
> Hi Group,
> I'm using svn version of django and SQLite3 on linux. I set up a basic
> admin user and when I try to access the edit page I get the
> "TemplateSyntaxError at /admin/auth/user/1/
> Caught an exception while rendering: dict objects are unhashable"
>
> Is this a bug? how far back should I downgrade to get around it?
>
> error screen paste below...
>
>  >
> 9 {% if field.is_checkbox %}
> 10{{ field.field }}{{ field.label_tag }}
> 11{% else %}
> 12{{ field.label_tag }}{{ field.field }} <<--- This
> {{field.field}} is highlighted red in the debug screen!
> 13{% endif %}
> 14{% if field.field.field.help_text %}
> {{ field.field.field.help_text|safe }}{% endif %}
> 15
> >
>
Can you paste the admin.py file or other code for the app that's giving you
this error?
Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you want"
-- Me

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: multi applications

2009-07-14 Thread sjtirtha
Thank you for the explanation.
This helps me very much.

You mentions about handling the smaller apps on the page with AJAX. Is there
any basic functionality to do this from Django Framework?
Or do you have any ajax lib/framework as preference?

Steve

On Tue, Jul 14, 2009 at 9:10 PM, Shawn Milochik wrote:

>
>
> On Jul 14, 2009, at 2:57 PM, sjtirtha wrote:
>
> > Hi,
> >
> > I'm looking for documentation, which describes how to build a web
> > application which includes many other applications.
> > For example like Facebook, it has following applications on the
> > first screen:
> > 1. On the left side is dynamic menu
> > 2. In the middle is the microblogging
> > 3. On the right side on the top is Request block
> > 4. On the right side in the middle is Highlights
> >
> > How can I build a web application like this? I was thinking to have
> > a main application which has a template that includes all other
> > applications.
> > But how can I set the context specific for every templates of the
> > included applications?
> >
> > regards,
> >
> > Steve
>
>
> There are several different aspects to what you are asking for and
> describing. The first part is showing all the apps within one page,
> and that's just a matter of a well-formatted CSS/HTML template. This
> template may (should?) include smaller templates (for each section).
>
> Ultimately your page will be called by a single URL, so you'll receive
> the entire request in one place. From there, you will have to decide
> how to handle the contexts. Look into the RequestContext class. The
> things you need to display on all pages, regardless of what the "main"
> view is at the moment, can be moved over there to avoid clutter.
>
> The "main" content could be handled in the view called directly by
> urls.py, and the rest can be inherited from the context dictionary
> keys coming from your request contexts.
>
> Also, you'll probably want/need to handle all the smaller apps on the
> page with AJAX, because you won't want to refresh the entire page for
> updating the microblog, etc. And since you're referring to FaceBook,
> they even do most of the processing of actions in the "main" section
> with AJAX, just to have a smoother user experience.
>
> These are certainly vague answers. If this isn't what you're asking
> for, please provide more detail.
>
> Shawn
>
>
>
> >
>

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



dict objects are unhashable in admin... in this a bug?

2009-07-14 Thread Some Guy

Hi Group,
I'm using svn version of django and SQLite3 on linux. I set up a basic
admin user and when I try to access the edit page I get the
"TemplateSyntaxError at /admin/auth/user/1/
Caught an exception while rendering: dict objects are unhashable"

Is this a bug? how far back should I downgrade to get around it?

error screen paste below...


9 {% if field.is_checkbox %}
10{{ field.field }}{{ field.label_tag }}
11{% else %}
12{{ field.label_tag }}{{ field.field }} <<--- This
{{field.field}} is highlighted red in the debug screen!
13{% endif %}
14{% if field.field.field.help_text %}
{{ field.field.field.help_text|safe }}{% endif %}
15
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Import all modelspy from all apps

2009-07-14 Thread Alex Gaynor
On Tue, Jul 14, 2009 at 2:18 PM, Gustavo Henrique wrote:

>
> Hi guys!
>
> How to import all models.py from all apps in a specific views.py in
> one app in my project automatically?
>
> Thanks!
>
> >
>
You can use the django model cache:
from django.db.models.loading import cache

cache.get_apps() will returns the models.py modules for all your apps.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you want"
-- Me

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Import all modelspy from all apps

2009-07-14 Thread Gustavo Henrique

Hi guys!

How to import all models.py from all apps in a specific views.py in
one app in my project automatically?

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 email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: multi applications

2009-07-14 Thread Shawn Milochik


On Jul 14, 2009, at 2:57 PM, sjtirtha wrote:

> Hi,
>
> I'm looking for documentation, which describes how to build a web  
> application which includes many other applications.
> For example like Facebook, it has following applications on the  
> first screen:
> 1. On the left side is dynamic menu
> 2. In the middle is the microblogging
> 3. On the right side on the top is Request block
> 4. On the right side in the middle is Highlights
>
> How can I build a web application like this? I was thinking to have  
> a main application which has a template that includes all other  
> applications.
> But how can I set the context specific for every templates of the  
> included applications?
>
> regards,
>
> Steve


There are several different aspects to what you are asking for and  
describing. The first part is showing all the apps within one page,  
and that's just a matter of a well-formatted CSS/HTML template. This  
template may (should?) include smaller templates (for each section).

Ultimately your page will be called by a single URL, so you'll receive  
the entire request in one place. From there, you will have to decide  
how to handle the contexts. Look into the RequestContext class. The  
things you need to display on all pages, regardless of what the "main"  
view is at the moment, can be moved over there to avoid clutter.

The "main" content could be handled in the view called directly by  
urls.py, and the rest can be inherited from the context dictionary  
keys coming from your request contexts.

Also, you'll probably want/need to handle all the smaller apps on the  
page with AJAX, because you won't want to refresh the entire page for  
updating the microblog, etc. And since you're referring to FaceBook,  
they even do most of the processing of actions in the "main" section  
with AJAX, just to have a smoother user experience.

These are certainly vague answers. If this isn't what you're asking  
for, please provide more detail.

Shawn



--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



problem with redirect

2009-07-14 Thread Petry

Hello Guys,

I'm having some trouble using redirect in my application

after making a request, rather than redirect to the domain + the url
it is sending to the IP address of the domain, I capture the request
through the Firefox addon HTTP_HEADERS:


#request# GET https://www.ucs.br/favicon.ico
#request# GET https://www.ucs.br/site/administracao/banners/1/edicao/
#request# POST https://www.ucs.br/site/administracao/banners/1/edicao/
POST /site/administracao/banners/1/edicao/ titulo=Matr%C3%ADculas+On-
line+%3Cbr%2F%3EPer%C3%ADodo+2009%2F4=http%3A%2F%2Fwww.ucs.br
%2Fucs%2Fgraduacao%2Fmatriculas_online
%2Fmatricula_online_exibicao_0=14%2F05%2F2009_exibicao_1=18%3A00%3A47_exibicao_0=15%2F06%2F2009_exibicao_1=22%3A00%3A00=R
#request# GET http://200.160.128.111:8005/site/administracao/banners/1/
#request# GET 
https://ucsvirtual.ucs.br/login/?next=/site/administracao/banners/1/

note that I am using https, and the field, when I, in the redirect
using the reverse:

post_save_redirect = reverse ( 'apps.banners.views.exibe', args =
[banner_id])

he sends it to the address above, (ip and http)

--
Marcos Daniel Petry
http://mdpetry.net

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: inheriting Model more than once

2009-07-14 Thread Luc Saffre

On 14.07.2009 17:23, Alex Gaynor wrote:
> This looks like an instance of this:
> http://code.djangoproject.com/ticket/10808 bug.

Thanks, Alex. I applied patch 10808.diff and now it works.

Luc

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: home page caching

2009-07-14 Thread Ramdas S
On Tue, Jul 14, 2009 at 11:47 PM, Michel Thadeu Sabchuk
wrote:

>
> Hi Ramdas,
>
> > It would be great if you can throw some more light on your solution.
> Sounds
> > like a splendid idea and will be helpful for many including me
>
> This is easy, I loaded the page through urllib and write it to a
> static file, then I served the file through nginx. Anyway, I will
> create a snippet for this ;)
>
> Best regards,
>
> --
> Michel Sabchuk
> http://turbosys.com.br/
> >
>
Aww, that's a cool idea

-- 
Ramdas S
+91 9342 583 065

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



multi applications

2009-07-14 Thread sjtirtha
Hi,

I'm looking for documentation, which describes how to build a web
application which includes many other applications.
For example like Facebook, it has following applications on the first
screen:
1. On the left side is dynamic menu
2. In the middle is the microblogging
3. On the right side on the top is Request block
4. On the right side in the middle is Highlights

How can I build a web application like this? I was thinking to have a main
application which has a template that includes all other applications.
But how can I set the context specific for every templates of the included
applications?

regards,

Steve

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to store user

2009-07-14 Thread Shawn Milochik


On Jul 14, 2009, at 2:50 PM, Viktor Semykin wrote:

>
> Hi everyone.
>
> I use django.views.generic.create_update.create_object to allow users
> to post new entries on my site.
> How can I make model automatically save the user currently logged in?
> Model like
> class MyModel(Model):
>user = ForeignKey(User)
> --~--~-~--~~~---~--~~

Set user = request.user in your view.

A slightly more "automatic" way of doing it would be
to override the save method of your model, but I think
you'd still have to pass the user instance into it.



--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to store user

2009-07-14 Thread Viktor Semykin

Hi everyone.

I use django.views.generic.create_update.create_object to allow users
to post new entries on my site.
How can I make model automatically save the user currently logged in?
Model like
class MyModel(Model):
user = ForeignKey(User)
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Creating Model with ManyToMany relationship from PyAMF & Flex

2009-07-14 Thread Jesse Warden
n00b here.  I'd like to create a complex Model from a Flex Object (basically
decoded JSON).  I've created a Model successfully already, but am unsure how
to do this with the multiple Models that have ManyToMany relationships with
each other.
This works:

def create_power(request, powerObj):
try:
p = Power()
p.name = powerObj.name
p.level = powerObj.level
p.save()
...


However, I'd like to create the other models too.  Psuedo structure:

class PowerSource(models.Model):
label = models.CharField(max_length=200)
power = models.ManyToManyField(Power)

What would the code look like... maybe like this?

ps = PowerSource()
ps.label = powerObj.powerSource.label;
ps.power = p;
ps.save()

Thanks if you can help!

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: home page caching

2009-07-14 Thread Michel Thadeu Sabchuk

Hi Ramdas,

> It would be great if you can throw some more light on your solution. Sounds
> like a splendid idea and will be helpful for many including me

This is easy, I loaded the page through urllib and write it to a
static file, then I served the file through nginx. Anyway, I will
create a snippet for this ;)

Best regards,

--
Michel Sabchuk
http://turbosys.com.br/
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newbie question information about js

2009-07-14 Thread Shawn Milochik


On Jul 14, 2009, at 12:30 PM, luca72 wrote:

>
> Hello
> I have a question in my view fiole i have this
>
> def myfunct()
> do this...
> now i need only to return a js alert message on the same page
> is it possible?

We need more information. Are you calling myfunct() via an AJAX call?  
I don't see a request in the argument list, but is that because you  
left it out, or is this not a "view" function (receives request and  
returns a response)?

Your function executes server-side, and JavaScript (obviously)  
executes client-side. Python can't do the alert box, but it can:

1. Render a template containing the JavaScript.
2. Pass the JavaScript text into a templatt, via the Context.
3. Return a JSON value via AJAX to the template's JavaScript (you have  
to bind the handler in the JavaScript, preferably using jQuery for  
ease-of-use) that passes the message to be used for the alert.

I hope this helps. If not, please send more relevant detail. Pretend  
you're explaining the problem to someone who has no idea what you're  
talking about, because we don't.

Shawn

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django admin for PHP?

2009-07-14 Thread diogobaeder

I've had a great experience with Symfony, with which I worked for
about 9 months, and I can tell it's a great framework, and also fairly
easy to create admin interfaces. Of course, not as easy as Django, as
you said, but...

I also tried CakePHP for a time, but I didn't like the means it used
to generate these kind of interfaces, and it's too "Railsy" for me -
maybe the Cake creators made it to use a Rails-like development
process in a non-Ruby-supporting environment, but if you like Rails
and can use it, just go for it -. Generating scaffolds for every app
isn't as easy, for me, as Symfony's or Django's ways of creating
admins.

Diogo



On Jul 14, 5:20 am, Maksymus007  wrote:
> On Tue, Jul 14, 2009 at 10:00 AM, Bela Hausmann wrote:
>
> > Hi everybody!
>
> > I use django a lot, and I'm really glad about the admin interface. I
> > always hated to code admin interfaces myself, never again :)
>
> > But now I have the task of making a new corporate website with a PHP
> > framework, and my question is, are there any frameworks, that have a
> > django-like (= powerfull, automatic, model based, easy) admin
> > interface/generater.
>
> > I know about the symfony admin generator (which is not as easy as the
> > django admin). Are there any more?
>
> > I know this is kind of off-topic, but only django users know how
> > powerful the django admin is, so I can't ask the PHP community.
>
> > Best regards from Austria,
> > Bela
>
> Symphony, CakePHP
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Converting django models to google app engine models

2009-07-14 Thread Vishwajeet

Hi All,

I am planning to host my django application on google app engine; I
have completed the application using django but now when I decided to
host it on google app engine I need to changed models and all it
reference to app engines framework; I have googled alot but have not
found much information on migrating models and how to go about it. I
found nifty examples but that does not cover the all
If any of you out there have any experience in same I would appreciate
if you can share the same.
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Image Field Validation

2009-07-14 Thread kevinski

Thanks Michael, I had no idea of this standard. Making a form for
images on a separate page will not be an issue.

Your help is greatly appreciated,
Kevin
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Style sheet not working after shifting from desktop to laptop

2009-07-14 Thread Javier Guerra

On Tue, Jul 14, 2009 at 12:08 PM, Fred
Chevitarese wrote:
> Use the Chrome Browser to see the source code generated by Django, and
> then you can follow the css of your page.

all browsers can show the page source, no need to push for any
specific one (yeah, Chrome is my favorite)

-- 
Javier

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Style sheet not working after shifting from desktop to laptop

2009-07-14 Thread Fred Chevitarese

Use the Chrome Browser to see the source code generated by Django, and
then you can follow the css of your page.

Than, you can see if this is pointing to the rigth place ;)

http://chevitarese.wordpress.com
Fred Chevitarese - GNU/Linux

On Jul 14, 9:55 am, Lakshman Prasad  wrote:
> Either you have a wrong directory pointed to, in your settings.py file for
> static media; or you haven't configured django to serve them.
>
> You need to define MEDIA_ROOT and MEDIA_URL in the settings.py
> appropriately. Once you have done that, you can setup django to serve those
> during development, by using the following pattern in the urls.py.
>
>     urlpatterns += patterns('django.views.static',
>         (r'^app/(?P.*)$', 'serve', { 'document_root':
> settings.DIRNAME,
>                                         'show_indexes': True }),
>     )
>
>
>
>
>
> On Tue, Jul 14, 2009 at 11:22 AM, djangonoob  wrote:
>
> > Hi, I have developed a simple application on my desktop computer
> > successfully using django 1.02, Ubuntu 9.04, python version 2.6.2
>
> > I copied my files over to my laptop computer and did the following:
> > 1) ran the django-admin.py startproject projectName
> > 2) cd to projectName folder, and ran the python manage.py startapp
> > appName.
>
> > After which i copied my application folder over to appName with the
> > same name.
>
> > Than i ran python manage.py runserver on my laptop
>
> > My application works, but than the css style sheet is not working; my
> > application has no style.
>
> > But upon inspecting the source code of the generated page, the  > rel="stylesheet" href="/media_user/css/style.css" type="text/css" />
> > url and others are correct.
>
> > But the style simply does not show.
>
> > Anyone faced this problem before and solve it?
>
> > best Regards.
>
> --
> Regards,
> Lakshmanhttp://uswaretech.com/
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Image Field Validation

2009-07-14 Thread Michael
On Tue, Jul 14, 2009 at 12:48 PM, kevinski  wrote:

>
> Hello,
>
> I am using 3 image fields in my model form. When I browse for images
> and submit, the images are uploaded with no problem. When my form does
> not validate, error messages appear for invalid fields and correct
> fields stay in tact, however my image paths disappear and I am
> required to browse for them again and again until the form finally
> validates. Anyone ever experience a similar problem? Any idea what I
> am missing?
>
> I've searched and searched and haven't found info on this. Please let
> me know if there is any code I could offer and I will post.
>

This is a security feature of the browser so that you don't accidentally
upload an arbitrary file to the server without knowing it. I don't know of a
way to get around it, nor would I hope there is one. This is the case for
all browsers and all internet forms. The only thing I can offer is to
separate your uploading from the rest of the form so you can save the image
even if someone types in a wrong phone number.

Hope that helps,

Michael

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



How to add a new button near to "Add a new article"

2009-07-14 Thread Fred Chevitarese

Hello!
I´m needing to add a button near to the button to add another object.
For example, there´s a app called Articles...
When i´m in the admin interface, i can see all the articles that i
have in the database in a grid. In the top, i have a button to add a
new article.
So, i want to put another button near to this, to call another view
for example. I can put a "link" in the grid that calls the desired
view, but, i really need to put it near to this button.

Can anyone help ?
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django-admin.py complains about missing DJANGO_SETTINGS_MODULE

2009-07-14 Thread Dhruv Adhia
Copy your app to site-packages folder and see if that works. If you dont
know where site-packages folder is , do 'which python' from command line and
you will get an idea.

Dhruv Adhia
http://thirdimension.com



On Tue, Jul 14, 2009 at 8:22 AM, Nate Reed  wrote:

> The admin tool is complaining about this environment variable, but I've
> never had this problem before on this box.  I'm not sure what's changed
> since the last time I used it.
>
> I tried specifying the path:
>
> $ django-admin.py syncdb --settings=mysite.settings
> Error: Could not import settings 'mysite.settings' (Is it on sys.path? Does
> it have syntax errors?): No module named mysite.settings
>
> What's the fix for this (short of modifying django-admin.py to add my
> project to the python import path)?
>
> I'm using django 1.0 (from SVN).
>
> Nate
>
>
> >
>

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Image Field Validation

2009-07-14 Thread kevinski

Hello,

I am using 3 image fields in my model form. When I browse for images
and submit, the images are uploaded with no problem. When my form does
not validate, error messages appear for invalid fields and correct
fields stay in tact, however my image paths disappear and I am
required to browse for them again and again until the form finally
validates. Anyone ever experience a similar problem? Any idea what I
am missing?

I've searched and searched and haven't found info on this. Please let
me know if there is any code I could offer and I will post.

Thanks!!!
Kevin
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



newbie question information about js

2009-07-14 Thread luca72

Hello
I have a question in my view fiole i have this

def myfunct()
 do this...
now i need only to return a js alert message on the same page
is it possible?

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Saving Data To Your DB. Simple?

2009-07-14 Thread Michael
On Tue, Jul 14, 2009 at 12:15 PM, The Danny Bos  wrote:

>
> Heya, am trying to simply save 3 values to a database, without using
> Forms.
>
> In the Template:
>
> 
>
>
>Rate This: {% for n in numbers %} value="{{ n }}">{{ n }}{% endfor %}
>
> 
>
> In the View:
>
> from mysite.rating.models import Rating
> def critics_rating(request):
>try:
>record_id = request.POST['record_id']
>user_id = request.POST['user_id']
>rating_val = request.POST['rating']
>
>rating = Rating()
>rating.rating = rating_val
>rating.item = record_id
>rating.writer = user_id
>rating.save()
>
>return HttpResponseRedirect('/')
>except:
>pass
>obj = Record.objects.get(id=record)
>return render_to_response('record/detail.html', {'object_detail':
> obj}, context_instance=RequestContext(request))
>
> It runs OK (no errors) but doesn't save a single thing, also it goes
> back to the 'detail.html' page fine, but when you hit reload, it sends
> the data again. Again, not saving.
>
> Any ideas what's wrong with this?
> I've done a lot of searching but all people seem to use the Forms
> widget, I was thinking as this is only three fields I'd skip that.
> Silly?


IMHO yes. It will save you a lot of hassles like this and will allow you to
add methods to clean and validate the data when you find that you need it.
The Form class was built to help you at this kind of thing.

To fix this chunk of code, get rid of the try: except statement. There is an
error occurring in you code after the try statement, and you have a catch
all there, so you are bound not to se it happen. That doesn't really help in
debugging,

Hope that helps,

Michael

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Saving Data To Your DB. Simple?

2009-07-14 Thread Lakshman Prasad
> It runs OK (no errors) but doesn't save a single thing
 It has to run without errors because you have enclosed the whole thing
in try.

 You have to coerce the record_id and user_id into int before assigning
to the model fields, for it to save.

On Tue, Jul 14, 2009 at 9:45 PM, The Danny Bos  wrote:

>
> Heya, am trying to simply save 3 values to a database, without using
> Forms.
>
> In the Template:
>
> 
>
>
>Rate This: {% for n in numbers %} value="{{ n }}">{{ n }}{% endfor %}
>
> 
>
> In the View:
>
> from mysite.rating.models import Rating
> def critics_rating(request):
>try:
>record_id = request.POST['record_id']
>user_id = request.POST['user_id']
>rating_val = request.POST['rating']
>
>rating = Rating()
>rating.rating = rating_val
>rating.item = record_id
>rating.writer = user_id
>rating.save()
>
>return HttpResponseRedirect('/')
>except:
>pass
>obj = Record.objects.get(id=record)
>return render_to_response('record/detail.html', {'object_detail':
> obj}, context_instance=RequestContext(request))
>
> It runs OK (no errors) but doesn't save a single thing, also it goes
> back to the 'detail.html' page fine, but when you hit reload, it sends
> the data again. Again, not saving.
>
> Any ideas what's wrong with this?
> I've done a lot of searching but all people seem to use the Forms
> widget, I was thinking as this is only three fields I'd skip that.
> Silly?
> >
>


-- 
Regards,
Lakshman
becomingguru.com
lakshmanprasad.com

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Deployment dilemma

2009-07-14 Thread Lakshman Prasad
zc.buildout  enables reproducible
build and deployments. pip offers a simple solution by the way of freeze and
requirements file at server.

On Tue, Jul 14, 2009 at 9:33 PM, Alex Gaynor  wrote:

>
>
> On Tue, Jul 14, 2009 at 10:46 AM, Rama Vadakattu  > wrote:
>
>>
>> I have a django project with N number of dependencies to other
>> packages.
>> Now i want to deploy the project on production server?
>>
>> As of now iam doing this.
>> 1.Move the django project to production server.
>> 2.install the dependencies on production server similar to that of the
>> way i have done on local system.
>>
>> Is it the right approach?
>> i feel reinstalling dependencies again on production server is
>> tedious.
>>
>> i would like to know how everyone  is dealing with the above problem.
>>
>> --rama
>>
>>
>>
>>
>>
>>
>>
> Take a look at PIP and it's requirement file system, which I think for
> python packages is a good solution.  If you have OS level dependencies (such
> as the stuff GIS relies on) you'll probably need to see what tools your
> packages manager offers.
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." -- Voltaire
> "The people's good is the highest law." -- Cicero
> "Code can always be simpler than you think, but never as simple as you
> want" -- Me
>
> >
>


-- 
Regards,
Lakshman
becomingguru.com
lakshmanprasad.com

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Complex form for a newbie with ImageField and ForeignField

2009-07-14 Thread djangonoob

thanks dude! that worked out perfectly for me.

On Jul 14, 8:48 pm, Lakshman Prasad  wrote:
> You could replace in the view:
>
> if form_upload.is_valid():
>   form_upload.save()
>
> # with this:
>
> if form_upload.is_valid():
>   form_upload.user = request.user
>   form_upload.save()
>
> You may also want to not display the user field in the form. You can do it
> by defining an 'exclude' Meta class attribute for the ModelForm, as done
> below. I believe you can also hide a field in the form by marking it
> "editable=False" in its model's field definition.
>
> class FormUpload(forms.ModelForm):
>
>     class Meta:
>         model = ModelName
>         exclude = ('user',)
>
>
>
> On Tue, Jul 14, 2009 at 5:53 PM, djangonoob  wrote:
>
> > I'm using django 1.02, Ubuntu 9.04, python 2.6.2
>
> > Issue: I am creating a simple application that allows users to upload
> > images.
> > I'm using the User from django.contrib.auth.models to manage my users.
> > For the image class, i have a ForeignKey to the user and a ImageField
> > to store my images
>
> > My application works perfectly, except that:
> > when the user uploads images, the images will be linked to the user
> > himself.
> > However, on the upload form, i have a option selection box where all
> > the usernames are selectable.
>
> > How do i fix the views.py, models.py such that the user can only
> > upload images using
> > his own username and at the same time, without having to select his
> > username from the dropdown selection box?
>
> > The following is my code:
> >http://dpaste.com/66944/
>
> > Thank you in advance.
>
> --
> Regards,
> Lakshman
> becomingguru.com
> lakshmanprasad.com
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Saving Data To Your DB. Simple?

2009-07-14 Thread The Danny Bos

Heya, am trying to simply save 3 values to a database, without using
Forms.

In the Template:




Rate This: {% for n in numbers %}{{ n }}{% endfor %}



In the View:

from mysite.rating.models import Rating
def critics_rating(request):
try:
record_id = request.POST['record_id']
user_id = request.POST['user_id']
rating_val = request.POST['rating']

rating = Rating()
rating.rating = rating_val
rating.item = record_id
rating.writer = user_id
rating.save()

return HttpResponseRedirect('/')
except:
pass
obj = Record.objects.get(id=record)
return render_to_response('record/detail.html', {'object_detail':
obj}, context_instance=RequestContext(request))

It runs OK (no errors) but doesn't save a single thing, also it goes
back to the 'detail.html' page fine, but when you hit reload, it sends
the data again. Again, not saving.

Any ideas what's wrong with this?
I've done a lot of searching but all people seem to use the Forms
widget, I was thinking as this is only three fields I'd skip that.
Silly?
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Deployment dilemma

2009-07-14 Thread Alex Gaynor
On Tue, Jul 14, 2009 at 10:46 AM, Rama Vadakattu
wrote:

>
> I have a django project with N number of dependencies to other
> packages.
> Now i want to deploy the project on production server?
>
> As of now iam doing this.
> 1.Move the django project to production server.
> 2.install the dependencies on production server similar to that of the
> way i have done on local system.
>
> Is it the right approach?
> i feel reinstalling dependencies again on production server is
> tedious.
>
> i would like to know how everyone  is dealing with the above problem.
>
> --rama
>
>
>
>
>
> >
>
Take a look at PIP and it's requirement file system, which I think for
python packages is a good solution.  If you have OS level dependencies (such
as the stuff GIS relies on) you'll probably need to see what tools your
packages manager offers.
Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you want"
-- Me

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Will future Django releases support multiple databases?

2009-07-14 Thread Emily Rodgers



On Jul 13, 4:51 pm, Emily Rodgers 
wrote:
> On Jul 3, 6:36 pm, Emily Rodgers 
> wrote:
>
>
>
> > 2009/7/3 Alex Gaynor :
>
> > > On Fri, Jul 3, 2009 at 12:25 PM, Emily Rodgers
> > >  wrote:
>
> > >> On Jul 3, 3:29 pm, Emily Rodgers 
> > >> wrote:
> > >> > On Jul 1, 3:44 pm, Alex Gaynor  wrote:
>
> > >> > > On Wed, Jul 1, 2009 at 9:39 AM, Emily Rodgers <
>
> > >> > > emily.kate.rodg...@googlemail.com> wrote:
>
> > >> > > > On Jul 1, 3:22 pm, Alex Gaynor  wrote:
> > >> > > > > On Wed, Jul 1, 2009 at 9:16 AM, Emily Rodgers <
>
> > >> > > > > emily.kate.rodg...@googlemail.com> wrote:
>
> > >> > > > > > On Jun 25, 6:45 pm, Alex Gaynor  wrote:
> > >> > > > > > > On Thu, Jun 25, 2009 at 10:24 AM, Tim Chase
> > >> > > > > > > wrote:
> > >> > > > > > > > > Right now, Django doesn't seem to support the multiple
> > >> > > > > > > > > databases on the same server or different servers.  Will
> > >> > > > > > > > > that
> > >> > > > > > > > > feature be available out of the box for future releases?
>
> > >> > > > > > > > You may want to eavesdrop on the Django Developers group 
> > >> > > > > > > > (as
> > >> > > > > > > > opposed to this Django Users group) where Alex Gaynor has
> > >> > > > > > > > been
> > >> > > > > > > > posting updates on his GSoC project to add multi-DB support
> > >> > > > > > > > to
> > >> > > > > > > > Django[1].  There are several aspects to multi-DB 
> > >> > > > > > > > support[2]
> > >> > > > > > > > but
> > >> > > > > > > > I believe he's addressing some of the more common 
> > >> > > > > > > > use-cases.
> > >> > > > > > > >  You
> > >> > > > > > > > can even follow along if you like to live dangerously as I
> > >> > > > > > > > believe he's got a public repository for his code on 
> > >> > > > > > > > GitHub.
>
> > >> > > > > > > > -tim
>
> > >> > > > > > > > [1]
>
> > >> > > > >http://groups.google.com/group/django-developers/search?group=django-.
> > >> > > > > > ..
>
> > >> > > > > > > > [2]
>
> > >> > > > >http://groups.google.com/group/django-users/browse_thread/thread/6630.
> > >> > > > > > ..
> > >> > > > > > > > for my posted concerns
>
> > >> > > > > > > I have both a public code repository on github at
> > >> > > > > > github.com/alex/django/ as
> > >> > > > > > > well as a branch in Django's SVN at branches/soc2009/multidb.
> > >> > > > > > >  The
> > >> > > > best
> > >> > > > > > > place to find out about the work is the django-developers
> > >> > > > > > > list, where
> > >> > > > I
> > >> > > > > > have
> > >> > > > > > > sent any number of emails discussing both the overall design,
> > >> > > > > > > as well
> > >> > > > as
> > >> > > > > > the
> > >> > > > > > > status.
>
> > >> > > > > > > Alex
>
> > >> > > > > > > --
> > >> > > > > > > "I disapprove of what you say, but I will defend to the death
> > >> > > > > > > your
> > >> > > > right
> > >> > > > > > to
> > >> > > > > > > say it." --Voltaire
> > >> > > > > > > "The people's good is the highest law."--Cicero
>
> > >> > > > > > Hi,
>
> > >> > > > > > Alex - do you know roughly when this is likely to be
> > >> > > > > > incorporated into
> > >> > > > > > django? I am working on a project that is going to need to
> > >> > > > > > connect to
> > >> > > > > > multiple databases (I am just planning / designing at the
> > >> > > > > > moment), and
> > >> > > > > > I want to know whether I should start investigating how to do
> > >> > > > > > this
> > >> > > > > > using django 1.0.2 or if that would be a waste of my time.
>
> > >> > > > > > If it is going to be a while, where would you suggest I start
> > >> > > > > > looking
> > >> > > > > > if I need to understand how to do it with django 1.0.2?
>
> > >> > > > > > Cheers,
> > >> > > > > > Em
>
> > >> > > > > It will, at a minimum not occur until the end of the summer.
> > >> > > > >  Beyond that
> > >> > > > I
> > >> > > > > can't make any really useful guesses, other than to say that the
> > >> > > > aggregation
> > >> > > > > GSOC project from last summer
> > >> > > > > ultimately made it's way into django trunk in January, about 3-4
> > >> > > > > months
> > >> > > > > after the official end of GSOC.  That may or may not ultimately 
> > >> > > > > be
> > >> > > > > representative of how long it will take multi-db to make it's way
> > >> > > > > back
> > >> > > > into
> > >> > > > > Django.  A lot of it probably depends on how the 1.2/1.3 releases
> > >> > > > > are
> > >> > > > > scheduled.  For example is 1.2 ends up being a smaller release
> > >> > > > > that's put
> > >> > > > > out in Novemberish I wouldn't expect multi-db to be considered 
> > >> > > > > for
> > >> > > > > trunk
> > >> > > > > until 1.3.  Like I said all of that's rather speculative :)
>
> > >> > > > > Alex
> > >> > > > > --
> > >> 

Re: Has anything changed with Sagepay/protx apart from the name?

2009-07-14 Thread Daniel Hilton
To answer the original post:

Sagepay AFAIK is a rebrand as sage have owned protx for a while now.

Nothing should have changed apart from names of products.
Cheers,
Dan



2009/7/14 Kip Parker 

>
> No, I did not. Oh dear. Thanks for pointing this out Karen.
>
> I am now off to the Satchmo group to post the same message, in case
> anyone was wondering what it was all about.
>
> Kip.
>
> On Jul 14, 1:47 pm, Karen Tracey  wrote:
> > On Tue, Jul 14, 2009 at 7:42 AM, Kip Parker  wrote:
> >
> > > I noticed whilst researching which payment gateway to use that Protx
> > > has become Sagepay. Anyone know if they've just changed the name (so
> > > that the Protx payment module still works OK) or if they've changed
> > > the product at all (so the Protx module doesn't)?
> >
> > Did you ask this on the right list?  I can't recall ever hearing either
> of
> > these names mentioned before, so I'm not sure they have anything to do
> with
> > Django?
> >
> > Karen
> >
>


-- 
Dan Hilton

DanHilton.co.uk


--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Deployment dilemma

2009-07-14 Thread Rama Vadakattu

I have a django project with N number of dependencies to other
packages.
Now i want to deploy the project on production server?

As of now iam doing this.
1.Move the django project to production server.
2.install the dependencies on production server similar to that of the
way i have done on local system.

Is it the right approach?
i feel reinstalling dependencies again on production server is
tedious.

i would like to know how everyone  is dealing with the above problem.

--rama





--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Reading data from database tied to another Django project?

2009-07-14 Thread Benjamin Kreeger

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 reStructuredText files; if I were to set up that site to
access P2's database (in P1's settings.py file), would I be able to
(eek) do raw SQL to get the data to display the way I want? Or would
there be an easier way to do that WITHOUT raw SQL, and WITHOUT
duplicating that model declared on P2?

Ben

On Jul 10, 3:58 pm, Ian Clelland  wrote:
> 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 two projects live in completely separate databases, then there
> is no easy way to do that (yet -- there's a GSoC project being
> actively worked on by Alex Gaynor to provide multi-database support in
> Django)
>
> In a similar situation, where both projects had a database on a common
> mysql server, I managed to do this with a one-line change to the
> Django mysql backend, which allowed me to specify a table in the
> model's Meta class as "database.table" -- this only works because
> MySQL allows you to access tables in one database from a connection to
> another, as long as your credentials are valid for both.
>
> Another (mysql-only, unfortunately) solution is to run mysqlproxy in
> front of your P2 database, and have it direct requests for P1 tables
> to the P1 database server. You would have to be careful to avoid any
> sort of queries that tried to join the tables from the two databases
> together, though -- avoiding foreign keys from P1 models to P2 models
> should be enough.
>
> Ian
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django-admin.py complains about missing DJANGO_SETTINGS_MODULE

2009-07-14 Thread Nate Reed
The admin tool is complaining about this environment variable, but I've
never had this problem before on this box.  I'm not sure what's changed
since the last time I used it.

I tried specifying the path:

$ django-admin.py syncdb --settings=mysite.settings
Error: Could not import settings 'mysite.settings' (Is it on sys.path? Does
it have syntax errors?): No module named mysite.settings

What's the fix for this (short of modifying django-admin.py to add my
project to the python import path)?

I'm using django 1.0 (from SVN).

Nate

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Count from 1 to 50

2009-07-14 Thread The Danny Bos


Great idea.
Don't know why I didn't think of that ...

Thanks man,

d



On Jul 15, 12:48 am, Shawn Milochik  wrote:
> On Jul 14, 2009, at 10:27 AM, The Danny Bos wrote:
>
>
>
> > Is there a way to create a simple list using Django to go from 1 to
> > 50.
> > Eg:
>
> > 1, 2, 3, 4, 5 ... 49, 50
>
> > I figured it'd be easy, but I can't get it.
> > I tried ...
>
> >    {% for i = 1 in 10 %}
> >      {{ i }},
> >    {% endfor %}
>
> > No go.
>
> There may be a better way, but why not just pass a range in the context?
>
> context = {'numbers': range(1,51)}
>
> Then you can do:
>
> {% for num in numbers %}
> ...
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Count from 1 to 50

2009-07-14 Thread Michael
On Tue, Jul 14, 2009 at 10:48 AM, Shawn Milochik wrote:

>
>
> On Jul 14, 2009, at 10:27 AM, The Danny Bos wrote:
>
> >
> > Is there a way to create a simple list using Django to go from 1 to
> > 50.
> > Eg:
> >
> > 1, 2, 3, 4, 5 ... 49, 50
> >
> > I figured it'd be easy, but I can't get it.
> > I tried ...
> >
> >   {% for i = 1 in 10 %}
> > {{ i }},
> >   {% endfor %}
> >
> > No go.
>
> There may be a better way, but why not just pass a range in the context?
>
> context = {'numbers': range(1,51)}
>
> Then you can do:
>
> {% for num in numbers %}
> ...
>

Here is a range filter that will make your int variable a range to loop
over: http://www.djangosnippets.org/snippets/1357/

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



New app: twivert.com

2009-07-14 Thread Vignesh.isquare

I have just finished creating a new app URL: http://www.twivert.com
It is a ad network for twitter.com.
Technologies used: google app engine, django, blueprint css for
style , jquery for javascript. If anyone
is interested, please visit the site and post your comments...
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Database Model Layout Advice

2009-07-14 Thread Shawn Milochik


On Jul 14, 2009, at 10:35 AM, Jonathan Buchanan wrote:

> 
> One option would be to use a generic relation:
>
> http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1
>
> Regards,
> Jonathan.
>
> 

Yes, this is probably the right way to do it. I had heard about  
generic relation, but forgot.

Shawn

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Count from 1 to 50

2009-07-14 Thread Shawn Milochik


On Jul 14, 2009, at 10:27 AM, The Danny Bos wrote:

>
> Is there a way to create a simple list using Django to go from 1 to
> 50.
> Eg:
>
> 1, 2, 3, 4, 5 ... 49, 50
>
> I figured it'd be easy, but I can't get it.
> I tried ...
>
>   {% for i = 1 in 10 %}
> {{ i }},
>   {% endfor %}
>
> No go.

There may be a better way, but why not just pass a range in the context?

context = {'numbers': range(1,51)}

Then you can do:

{% for num in numbers %}
...

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Question regarding post_save signal and ManyToMany field objects

2009-07-14 Thread Alex Gaynor
On Tue, Jul 14, 2009 at 9:35 AM, Russell Keith-Magee  wrote:

>
> On Tue, Jul 14, 2009 at 6:27 PM, Ryan K wrote:
> >
> > Yea...it would be so elegant too! Here is a "bug" filing:
> > http://code.djangoproject.com/ticket/5390. It's been open for two
> > years
>
> A little history may help explain why this has been open for so long.
>
> Historically (i.e., when dinosaurs roamed the Django source code)
> signals were _very_ expensive - even signals that had no listeners. As
> a result, there was a lot of resistance to adding new signals. Given
> the performance cost, the decision was made to live without m2m
> signals.
>
> Just prior to v1.0, the signal framework was updated, which made
> signals much faster. However, in an attempt to actually hit the
> deadline for getting 1.0 out the door, adding new signals wasn't on
> the plan.
>
> Adding new signals was discussed as a possible feature for v1.1 (see
> the features page [1]); however, nobody took charge of getting it
> done, and other development priorities took over. The feature deadline
> arrived before anyone got around to implementing (and integrating) the
> change.
>
> When the v1.2 development cycle starts, I'm sure this will be back on
> the schedule again.
>
> [1] http://code.djangoproject.com/wiki/Version1.1Features
>
> Yours,
> Russ Magee %-)
>
> >
>
The best way now to get this feature is to use an intermediary model which
obviously get's its own signals.  Additionally I've been working on
refactoring m2ms to always use an intermediary model, thus signals would
always be sent.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you want"
-- Me

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Database Model Layout Advice

2009-07-14 Thread Jonathan Buchanan

2009/7/14 The Danny Bos :
>
> Hey there, this may not be appropriate, but I'm building in Django so
> here goes ...
>
> I'm creating an Interviews app/table in my Django 'Books' (test)
> project. Just wrapping my head around it before I start on my music
> based website ... Anyway,
>
> For my 'Interview' table, how would I assign an interview to an
> 'Author' or an 'Illustrator', as they both have separate tables
> themselves. Know what I mean? Seems crazy to choose either the Author
> from the list OR the Illustrator, how would I assign an Interview to
> either?
>
> Here's the layout for 'Interview':
>
> class Interview(models.Model):
>        body = models.TextField()
>        publication_date = models.DateField(auto_now=True)
>
>        author = models.ForeignKey('books.Author')
>        illustrator = models.ForeignKey('books.Illustrator')
>
>        class Meta:
>                ordering = ['publication_date']

One option would be to use a generic relation:

http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#id1

Regards,
Jonathan.

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Question regarding post_save signal and ManyToMany field objects

2009-07-14 Thread Russell Keith-Magee

On Tue, Jul 14, 2009 at 6:27 PM, Ryan K wrote:
>
> Yea...it would be so elegant too! Here is a "bug" filing:
> http://code.djangoproject.com/ticket/5390. It's been open for two
> years

A little history may help explain why this has been open for so long.

Historically (i.e., when dinosaurs roamed the Django source code)
signals were _very_ expensive - even signals that had no listeners. As
a result, there was a lot of resistance to adding new signals. Given
the performance cost, the decision was made to live without m2m
signals.

Just prior to v1.0, the signal framework was updated, which made
signals much faster. However, in an attempt to actually hit the
deadline for getting 1.0 out the door, adding new signals wasn't on
the plan.

Adding new signals was discussed as a possible feature for v1.1 (see
the features page [1]); however, nobody took charge of getting it
done, and other development priorities took over. The feature deadline
arrived before anyone got around to implementing (and integrating) the
change.

When the v1.2 development cycle starts, I'm sure this will be back on
the schedule again.

[1] http://code.djangoproject.com/wiki/Version1.1Features

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Count from 1 to 50

2009-07-14 Thread The Danny Bos

Is there a way to create a simple list using Django to go from 1 to
50.
Eg:

1, 2, 3, 4, 5 ... 49, 50

I figured it'd be easy, but I can't get it.
I tried ...

{% for i = 1 in 10 %}
  {{ i }},
{% endfor %}

No go.
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: inheriting Model more than once

2009-07-14 Thread Alex Gaynor
On Tue, Jul 14, 2009 at 7:15 AM, Luc Saffre  wrote:

>
> """
> Can somebody explain why this testcase fails? It looks as if the
> attribute 'a' passed to the E instance just gets ignored.
> I guess that it has to do with the fact that E inherits Model more than
> once.
>
>  >>> i1 = D(a='D')
>  >>> i1.a
>  'D'
>
>  >>> i2 = E(a='E')
>  >>> i2.a
>  'E'
>
> The failure is::
>
>  Failed example:
>  i2.a
>  Expected:
>  'E'
>  Got:
>  ''
>
> To try this test, save the body of this mail as a file models.py
> together with an empty __init__.py in some new directory on your
> PYTHONPATH, add this to your INSTALLED_APPS and then run "manage.py test".
>
> """
>
> from django.db import models
>
> class A(models.Model):
>a = models.CharField(max_length=100)
>class Meta:
>abstract = True
>
> class B(A): pass
> class C(A): pass
>
> class D(B): pass
> class E(B,C): pass
>
>
>
> >
>
This looks like an instance of this:
http://code.djangoproject.com/ticket/10808 bug.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you want"
-- Me

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Has anything changed with Sagepay/protx apart from the name?

2009-07-14 Thread Kip Parker

No, I did not. Oh dear. Thanks for pointing this out Karen.

I am now off to the Satchmo group to post the same message, in case
anyone was wondering what it was all about.

Kip.

On Jul 14, 1:47 pm, Karen Tracey  wrote:
> On Tue, Jul 14, 2009 at 7:42 AM, Kip Parker  wrote:
>
> > I noticed whilst researching which payment gateway to use that Protx
> > has become Sagepay. Anyone know if they've just changed the name (so
> > that the Protx payment module still works OK) or if they've changed
> > the product at all (so the Protx module doesn't)?
>
> Did you ask this on the right list?  I can't recall ever hearing either of
> these names mentioned before, so I'm not sure they have anything to do with
> Django?
>
> Karen
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Database Model Layout Advice

2009-07-14 Thread Shawn Milochik


On Jul 14, 2009, at 9:23 AM, The Danny Bos wrote:

>
>
> So the Author and Illustrator tables would stay as is.
> How would the Interview table talk to both of those tables at once, to
> allow me to assign an interview to who I'm interviewing. Whether it's
> an Illustrator, Author or even down the track a Publisher.
>
> Like so?
>
> class Interview(models.Model):
>body = models.TextField()
>publication_date = models.DateField(auto_now=True)
>
>interview_subject = ...
>
>class Meta:
>ordering = ['publication_date']
>
>


No, the other way around. The interview table wouldn't have anything  
in it to point to the illustrator or author. The Author and  
Illustrator models would each have a ManyToMany field defined to the  
Interview model. The "related_name" property of this field will give  
you an easy way, when using an Interview model, to pull its related  
Author or Illustrator objects. When you start with an Interview  
object, you'll need to do something like check to see if:   
len(this_interview.author.all()) > 0

Shawn

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Database Model Layout Advice

2009-07-14 Thread The Danny Bos


So the Author and Illustrator tables would stay as is.
How would the Interview table talk to both of those tables at once, to
allow me to assign an interview to who I'm interviewing. Whether it's
an Illustrator, Author or even down the track a Publisher.

Like so?

class Interview(models.Model):
body = models.TextField()
publication_date = models.DateField(auto_now=True)

interview_subject = ...

class Meta:
ordering = ['publication_date']




On Jul 14, 11:19 pm, Shawn Milochik  wrote:
> I think you'd just have the interview table without any foreign keys,  
> then add a ManyToMany to each of your Author and Illustrator models.
>
> You would still, of course, be able to start with your interview table  
> and get the authors or illustrators, if necessary in your app. It  
> might be handy to set the related_name property of this field for easy  
> reference from your Interview model.
>
> Shawn
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Database Model Layout Advice

2009-07-14 Thread Shawn Milochik

I think you'd just have the interview table without any foreign keys,  
then add a ManyToMany to each of your Author and Illustrator models.

You would still, of course, be able to start with your interview table  
and get the authors or illustrators, if necessary in your app. It  
might be handy to set the related_name property of this field for easy  
reference from your Interview model.

Shawn

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Way to show Progress bar in django while processing to send emails

2009-07-14 Thread Shawn Milochik


On Jul 14, 2009, at 2:51 AM, gganesh wrote:

>
> Hi friends,
> It could be helpful if someone suggest me to find a way to show
> Progress Bar while django is processing to send mails .I have a form
> where list of email Id's are displayed with checkbox and user selects
> those and submits.Here i need to show a progress bar till django
> finished its process of sending mails .is there any way to achieve
> this .
> >

AJAX is a good solution.

When the user hits the submit button, have JavaScript (I recommend  
jQuery) cancel the actual page submission and instead send the POST  
request.

If I understand what you're saying, you want to do something for some  
number of checkboxes on the page. In which case, you could write a  
function which accepts a value (e-mail address, maybe?), then write a  
JavaScript loop to iterate through the checkboxes, count the number to  
process, then call your function repeatedly in the loop, updating a  
status bar based on how many have been completed so far.

As for the status bar, check docs.jquery.com or the docs for jQueryUI  
to see if there's a pre-made one. I'm pretty sure there is. Worst  
case, you get a thin graphic and dynamically change its width to a  
percentage of the div it's in or something.

Shawn

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: was not closed

2009-07-14 Thread Karen Tracey
On Tue, Jul 14, 2009 at 8:21 AM, Robert  wrote:

>
> Hi,
>
> My web hosting company get the curious error message above when
> configuring httpd.conf.
>
> [snip]
>
>  admin/media">
> SetHandler None 
>

I don't believe you can put the  on the same line as the
SetHandler.  If that is literally what has really been placed in the apache
config file that might be the problem: try putting a line break before the
.

Karen

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: I need to get psycopg2 installed on Mac OS X 10.5

2009-07-14 Thread Shawn Milochik

I had the same terrors. Unfortunately I didn't document exactly how I  
did it, but my best recollection is that this will work:

1. Update setuptools: sudo easy_install -U setuptools

2. Download and unzip the tarball for psycopg2.

3. Edit the config file for psycopg2 as directed on other Web sites,
paying special attention to the pg_config argument (make sure it  
points to the right place in your /Library/PostgreSQL folder).

4. Run: sudo python setup.py install



--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Style sheet not working after shifting from desktop to laptop

2009-07-14 Thread Lakshman Prasad
Either you have a wrong directory pointed to, in your settings.py file for
static media; or you haven't configured django to serve them.

You need to define MEDIA_ROOT and MEDIA_URL in the settings.py
appropriately. Once you have done that, you can setup django to serve those
during development, by using the following pattern in the urls.py.

urlpatterns += patterns('django.views.static',
(r'^app/(?P.*)$', 'serve', { 'document_root':
settings.DIRNAME,
'show_indexes': True }),
)


On Tue, Jul 14, 2009 at 11:22 AM, djangonoob  wrote:

>
> Hi, I have developed a simple application on my desktop computer
> successfully using django 1.02, Ubuntu 9.04, python version 2.6.2
>
> I copied my files over to my laptop computer and did the following:
> 1) ran the django-admin.py startproject projectName
> 2) cd to projectName folder, and ran the python manage.py startapp
> appName.
>
> After which i copied my application folder over to appName with the
> same name.
>
> Than i ran python manage.py runserver on my laptop
>
> My application works, but than the css style sheet is not working; my
> application has no style.
>
> But upon inspecting the source code of the generated page, the  rel="stylesheet" href="/media_user/css/style.css" type="text/css" />
> url and others are correct.
>
> But the style simply does not show.
>
> Anyone faced this problem before and solve it?
>
> best Regards.
>
> >
>


-- 
Regards,
Lakshman
http://uswaretech.com/

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Complex form for a newbie with ImageField and ForeignField

2009-07-14 Thread Lakshman Prasad
You could replace in the view:

if form_upload.is_valid():
  form_upload.save()


# with this:

if form_upload.is_valid():
  form_upload.user = request.user
  form_upload.save()


You may also want to not display the user field in the form. You can do it
by defining an 'exclude' Meta class attribute for the ModelForm, as done
below. I believe you can also hide a field in the form by marking it
"editable=False" in its model's field definition.

class FormUpload(forms.ModelForm):

class Meta:
model = ModelName
exclude = ('user',)




On Tue, Jul 14, 2009 at 5:53 PM, djangonoob  wrote:

>
> I'm using django 1.02, Ubuntu 9.04, python 2.6.2
>
> Issue: I am creating a simple application that allows users to upload
> images.
> I'm using the User from django.contrib.auth.models to manage my users.
> For the image class, i have a ForeignKey to the user and a ImageField
> to store my images
>
> My application works perfectly, except that:
> when the user uploads images, the images will be linked to the user
> himself.
> However, on the upload form, i have a option selection box where all
> the usernames are selectable.
>
> How do i fix the views.py, models.py such that the user can only
> upload images using
> his own username and at the same time, without having to select his
> username from the dropdown selection box?
>
> The following is my code:
> http://dpaste.com/66944/
>
> Thank you in advance.
> >
>


-- 
Regards,
Lakshman
becomingguru.com
lakshmanprasad.com

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Has anything changed with Sagepay/protx apart from the name?

2009-07-14 Thread Karen Tracey
On Tue, Jul 14, 2009 at 7:42 AM, Kip Parker  wrote:

>
> I noticed whilst researching which payment gateway to use that Protx
> has become Sagepay. Anyone know if they've just changed the name (so
> that the Protx payment module still works OK) or if they've changed
> the product at all (so the Protx module doesn't)?
>

Did you ask this on the right list?  I can't recall ever hearing either of
these names mentioned before, so I'm not sure they have anything to do with
Django?

Karen

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



DjangoCon 09 Recording (was: Re: DjangoCon '09)

2009-07-14 Thread Shawn Milochik

I've been listening to a lot of podcasts from PyCon 09, and for the  
most part the audio is horrible to the point of not being listenable.

Are there any plans in place to do any recording at DjangoCon yet?  
It's vital that the actual speaker is miked. If someone is recording,  
even from a few feet away, the sound is crap.

If there's no plan in place, then I'd be interested in helping out. I  
can bring at least one mic, and record at least the sessions I'm in,  
if it's okay with the organizers. Also, if PyCon 09 is any indicator,  
most speakers have no experience talking on-mic, so I'd give them a  
few tips. One of which is to repeat a question before answering it,  
because often the questioner doesn't make it onto the recording.

I was also thinking about getting another portable recorder, like the  
Zoom H-2, for recording events. If we can even get one of those onto  
each podium, I think we could have awesome sound quality.

So, if there's already something planned, please let me know. If not,  
let's see if we can hack something together so that everyone can  
benefit from an awesome event.

Shawn Milochik

sh...@milochik.com





--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Style sheet not working after shifting from desktop to laptop

2009-07-14 Thread Karen Tracey
On Tue, Jul 14, 2009 at 1:52 AM, djangonoob  wrote:

>
> Hi, I have developed a simple application on my desktop computer
> successfully using django 1.02, Ubuntu 9.04, python version 2.6.2
>
> I copied my files over to my laptop computer and did the following:
> 1) ran the django-admin.py startproject projectName
> 2) cd to projectName folder, and ran the python manage.py startapp
> appName.
>
> After which i copied my application folder over to appName with the
> same name.
>
> Than i ran python manage.py runserver on my laptop
>
> My application works, but than the css style sheet is not working; my
> application has no style.
>
> But upon inspecting the source code of the generated page, the  rel="stylesheet" href="/media_user/css/style.css" type="text/css" />
> url and others are correct.
>
> But the style simply does not show.
>
> Anyone faced this problem before and solve it?
>

You do not mention that you did anything to copy your settings.py and
urls.py file from your desktop to laptop.  (These are not in the application
directory you mention copying.)  Since your application generally works, I'd
guess you did do something to copy these files, but it sounds like (since
you say the href value in the returned html is correct) the urlpattern for
the static server to serve the css file is not set up correctly.

Karen

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Database Model Layout Advice

2009-07-14 Thread The Danny Bos

Hey there, this may not be appropriate, but I'm building in Django so
here goes ...

I'm creating an Interviews app/table in my Django 'Books' (test)
project. Just wrapping my head around it before I start on my music
based website ... Anyway,

For my 'Interview' table, how would I assign an interview to an
'Author' or an 'Illustrator', as they both have separate tables
themselves. Know what I mean? Seems crazy to choose either the Author
from the list OR the Illustrator, how would I assign an Interview to
either?

Here's the layout for 'Interview':

class Interview(models.Model):
body = models.TextField()
publication_date = models.DateField(auto_now=True)

author = models.ForeignKey('books.Author')
illustrator = models.ForeignKey('books.Illustrator')

class Meta:
ordering = ['publication_date']


--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Complex form for a newbie with ImageField and ForeignField

2009-07-14 Thread djangonoob

I'm using django 1.02, Ubuntu 9.04, python 2.6.2

Issue: I am creating a simple application that allows users to upload
images.
I'm using the User from django.contrib.auth.models to manage my users.
For the image class, i have a ForeignKey to the user and a ImageField
to store my images

My application works perfectly, except that:
when the user uploads images, the images will be linked to the user
himself.
However, on the upload form, i have a option selection box where all
the usernames are selectable.

How do i fix the views.py, models.py such that the user can only
upload images using
his own username and at the same time, without having to select his
username from the dropdown selection box?

The following is my code:
http://dpaste.com/66944/

Thank you in advance.
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



was not closed

2009-07-14 Thread Robert

Hi,

My web hosting company get the curious error message above when
configuring httpd.conf.

I'm trying to deploy a djangoproject on a public server. The
webhosting company isn't familiar with python and django. They don't
give access to httpd.conf to the clients. It's a cpanel type of
webhosting company.

Apache is configured with mod_python on the server.
So far I have simply uploaded the newest Django-release to a folder on
the server. As far as I know this is possible when you put Django on
your PythonPath.

I have asked the web hosting company to add the following to the
httpd.conf file. It should be pretty similar to the documentation:


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonOption django.root /mysite
PythonDebug On
PythonPath "['/home/account/django', '/home/account/www'] +
sys.path"


The first part in the PythonPath is the path to Django from my
document root.  The second part is the path to my public project.


SetHandler None 

The last segment is the path to the Django media files. The
documentation says that you should give the "url root" to the
mediafiles. I thought that "url root" was the same as the path from my
document root, thus a quite lengthy path.

I guess the error message " was not closed" came up in the
apache error log. I have googled the message but haven't been able to
find anything useful.

Initially I thought it could be a case of a missing bracket or
something, but the code seems fine.

Would you please look through my code and give me your opinion?

Thanks. Appreciate it.

Robert
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



inheriting Model more than once

2009-07-14 Thread Luc Saffre

"""
Can somebody explain why this testcase fails? It looks as if the
attribute 'a' passed to the E instance just gets ignored.
I guess that it has to do with the fact that E inherits Model more than
once.

  >>> i1 = D(a='D')
  >>> i1.a
  'D'

  >>> i2 = E(a='E')
  >>> i2.a
  'E'

The failure is::

  Failed example:
  i2.a
  Expected:
  'E'
  Got:
  ''

To try this test, save the body of this mail as a file models.py
together with an empty __init__.py in some new directory on your
PYTHONPATH, add this to your INSTALLED_APPS and then run "manage.py test".

"""

from django.db import models

class A(models.Model):
a = models.CharField(max_length=100)
class Meta:
abstract = True

class B(A): pass
class C(A): pass

class D(B): pass
class E(B,C): pass



--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



I need to get psycopg2 installed on Mac OS X 10.5

2009-07-14 Thread Kevin

I need to get psycopg2 installed on Mac OS X 10.5

I have read every install guide I could find and I still do not have
it working. I have developer tools installed. I am running MacPython
2.6.2 and PostgreSQL 8.4 downloaded from 
http://www.enterprisedb.com/products/pgdownload.do

On my production machine (Debian) I did a simple atp-get and it
worked. Why is it so much harder on Mac OS X?  I am very near ripping
my hair out because I have wasted too much time and I do not
understand why psycopg2 does not work on my machine.

Below are my notes from three attempts to install psycopg2.  I have
read other threads that suggest installing Python, PostgreSQL, and
psycopg2 from MacPorts.  I do not want to use MacPorts.  I do not see
why I need to use a completely different installation of Python to use
a simple database driver.



For my first attempt I followed the instructions listed here:
http://jasonism.org/weblog/2008/nov/06/getting-psycopg2-work-mac-os-x-leopard/
It told me to add these lines to setup.cfg:

include_dirs=/Library/PostgreSQL/8.3/include
library_dirs=/Library/PostgreSQL/8.3/lib

I then ran python setup.py build and got this error:

$ python setup.py build
running build
running build_py
creating build
creating build/lib.macosx-10.3-fat-2.6
creating build/lib.macosx-10.3-fat-2.6/psycopg2
copying lib/__init__.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
copying lib/errorcodes.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
copying lib/extensions.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
copying lib/extras.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
copying lib/pool.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
copying lib/psycopg1.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
copying lib/tz.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
running build_ext
error: No such file or directory


===


For my next attempt I followed the instructions listed here:
http://blog.jonypawks.net/2008/06/20/installing-psycopg2-on-os-x/
It told me to run this:

PATH=$PATH:/Library/PostgresPlus/8.3/bin/ sudo easy_install psycopg2

This resulted in this error: (I substituted "8.4" for "8.3" because my
version of PostgreSQL is newer)

$ PATH=$PATH:/Library/PostgreSQL/8.4/bin/ sudo easy_install psycopg2
Password:
Searching for psycopg2
Reading http://pypi.python.org/simple/psycopg2/
Reading http://initd.org/projects/psycopg2
Reading http://initd.org/pub/software/psycopg/
Best match: psycopg2 2.0.11
Downloading http://initd.org/pub/software/psycopg/psycopg2-2.0.11.tar.gz
Processing psycopg2-2.0.11.tar.gz
Running psycopg2-2.0.11/setup.py -q bdist_egg --dist-dir /tmp/
easy_install-dUXtsI/psycopg2-2.0.11/egg-dist-tmp-1008XV
warning: no files found matching '*.html' under directory 'doc'
warning: no files found matching 'MANIFEST'
/usr/libexec/gcc/i686-apple-darwin9/4.0.1/as: assembler (/usr/bin/../
libexec/gcc/darwin/i386/as or /usr/bin/../local/libexec/gcc/darwin/
i386/as) for architecture i386 not installed
/usr/libexec/gcc/powerpc-apple-darwin9/4.0.1/as: assembler (/usr/
bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/
darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/ppc64/as for architecture ppc64
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/ppc64/as for architecture ppc64
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
lipo: can't open input file: /var/tmp//ccSK6sd7.out (No such file or
directory)
error: Setup script exited with error: command 'gcc' failed with exit
status 1
Exception TypeError: TypeError("'NoneType' object is not callable",)
in > ignored
Exception TypeError: TypeError("'NoneType' object is not callable",)
in > ignored


===


For my third attempt I installed the binary of psycopg2 from
http://pythonmac.org/packages/py25-fat/index.html
I thought it worked, but when I tried to import the module in the
interpreter I got this error:

>>> import psycopg2
Traceback (most recent call last):
  File "", line 1, in 
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/psycopg2/__init__.py", line 60, in 
from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/
lib/python2.6/site-packages/psycopg2/_psycopg.so, 2): Library not
loaded: /usr/local/pgsql/lib/libpq.4.dylib
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/
lib/python2.6/site-packages/psycopg2/_psycopg.so
  Reason: image not found





What the hell do I need to do to get psycopg2 working with my
MacPython 2.6.2 install?  Sorry if I sound angry, but I have lost a
lot of time on something that seems like it should be easy.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django 

Re: Object attributes in change_form.html

2009-07-14 Thread janedenone

That did the trick. Thank you very much!

- Jan

On Jul 14, 12:53 pm, Ryan K  wrote:
> I'm not sure but try {{ original }} ...here is the code:
>
> http://code.djangoproject.com/browser/django/trunk/django/contrib/adm...
>
>     context = {
> 860                 'title': _('Change %s') % force_unicode
> (opts.verbose_name),
> 861                 'adminform': adminForm,
> 862                 'object_id': object_id,
> 863                 'original': obj,
> 864                 'is_popup': request.REQUEST.has_key('_popup'),
> 865                 'media': mark_safe(media),
> 866                 'inline_admin_formsets': inline_admin_formsets,
> 867                 'errors': helpers.AdminErrorList(form, formsets),
> 868                 'root_path': self.admin_site.root_path,
> 869                 'app_label': opts.app_label,
> 870             }
>
> On Jul 14, 5:37 am, janedenone  wrote:
>
>
>
> > On Jul 13, 10:05 pm, janedenone  wrote:
>
> > > On Jul 13, 6:07 pm, Daniel Roseman  wrote:
>
> > > > On Jul 13, 4:02 pm, janedenone  wrote:
>
> > > > > Hi,
>
> > > > > I read the documentation on customizing admin templates, but I still
> > > > > wonder how to access the object attributes in the change_form.html. I
> > > > > am capable of getting the id using {{ object_id }}:
>
> > > > > {% if change %}{% if not is_popup %}
> > > > >   
> > > > >      > > > > class="historylink">{% trans "View Calculation" %}
> > > > > ...
>
> > > > > but I need to access a couple of other attributes. {{ object_name }}
> > > > > does not work, nor does {{ object_cottage_name}} for getting a related
> > > > > object's name.
>
> > > > > Thankful for any hint.
>
> > > > > - Jan
>
> > > > The syntax for looking up attributes - in templates just like in
> > > > Python - is a dot, not an underscore. So you should use object.name,
> > > > etc.
>
> > > Many thanks, but that does not work either.
>
> > > - Jan
>
> > PS. I was using {{ object_id }} because this worked in the
> > object_tools block. "object" does not seem to be the object modified
> > via change_form.html, though.
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Has anything changed with Sagepay/protx apart from the name?

2009-07-14 Thread Kip Parker

I noticed whilst researching which payment gateway to use that Protx
has become Sagepay. Anyone know if they've just changed the name (so
that the Protx payment module still works OK) or if they've changed
the product at all (so the Protx module doesn't)?

Kip.
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: .views._CheckLogin.__call__ didn't return an HttpResponse object

2009-07-14 Thread alecs

Thanks. I thought this called view will do render_to_response ...
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Object attributes in change_form.html

2009-07-14 Thread Ryan K

I'm not sure but try {{ original }} ...here is the code:

http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/options.py

context = {
860 'title': _('Change %s') % force_unicode
(opts.verbose_name),
861 'adminform': adminForm,
862 'object_id': object_id,
863 'original': obj,
864 'is_popup': request.REQUEST.has_key('_popup'),
865 'media': mark_safe(media),
866 'inline_admin_formsets': inline_admin_formsets,
867 'errors': helpers.AdminErrorList(form, formsets),
868 'root_path': self.admin_site.root_path,
869 'app_label': opts.app_label,
870 }

On Jul 14, 5:37 am, janedenone  wrote:
> On Jul 13, 10:05 pm, janedenone  wrote:
>
>
>
>
>
> > On Jul 13, 6:07 pm, Daniel Roseman  wrote:
>
> > > On Jul 13, 4:02 pm, janedenone  wrote:
>
> > > > Hi,
>
> > > > I read the documentation on customizing admin templates, but I still
> > > > wonder how to access the object attributes in the change_form.html. I
> > > > am capable of getting the id using {{ object_id }}:
>
> > > > {% if change %}{% if not is_popup %}
> > > >   
> > > >      > > > class="historylink">{% trans "View Calculation" %}
> > > > ...
>
> > > > but I need to access a couple of other attributes. {{ object_name }}
> > > > does not work, nor does {{ object_cottage_name}} for getting a related
> > > > object's name.
>
> > > > Thankful for any hint.
>
> > > > - Jan
>
> > > The syntax for looking up attributes - in templates just like in
> > > Python - is a dot, not an underscore. So you should use object.name,
> > > etc.
>
> > Many thanks, but that does not work either.
>
> > - Jan
>
> PS. I was using {{ object_id }} because this worked in the
> object_tools block. "object" does not seem to be the object modified
> via change_form.html, though.
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: .views._CheckLogin.__call__ didn't return an HttpResponse object

2009-07-14 Thread Daniel Roseman

Please don't snip the context.

On Jul 14, 11:24 am, alecs  wrote:
> I'm just calling another view mail_to_user(request,username,dummy) ,
> which contains render_to_response!

OK, think what happens when you return from that view: you go back to
the calling view. Does that return anything?
--
DR.
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: .views._CheckLogin.__call__ didn't return an HttpResponse object

2009-07-14 Thread Ryan K

I'm not really sure I understand your question but you don't need to
jump to another view...you just need to pass the relevant objects to
the mailer function and then "return render_to_response(...)." If the
mailer function is already in another view, refactor the code and
create a non view function that handles mail.

Cheers,
Ryan

On Jul 14, 6:33 am, alecs  wrote:
> Ok, a simple question:
> Are there any possibilities to call from current view another view.
> For instance you have a large view and in the middle of it you need to
> perform THE SAME actions which are already defined in def foo
> (request,username).
> Of course, you can copy the contents of foo(request,username) view
> into your big view, but I don't think it's a correct solution.
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: .views._CheckLogin.__call__ didn't return an HttpResponse object

2009-07-14 Thread alecs

Ok, a simple question:
Are there any possibilities to call from current view another view.
For instance you have a large view and in the middle of it you need to
perform THE SAME actions which are already defined in def foo
(request,username).
Of course, you can copy the contents of foo(request,username) view
into your big view, but I don't think it's a correct solution.
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Question regarding post_save signal and ManyToMany field objects

2009-07-14 Thread Ryan K

Yea...it would be so elegant too! Here is a "bug" filing:
http://code.djangoproject.com/ticket/5390. It's been open for two
years

I understand that your really getting what you asked for, just the
instance of the model you just saved but to me (and it seems you and a
lot of other people), intuition leads people to write code that drives
them nuts because its not really "post_transaction."

On Jul 14, 4:08 am, Eugene Mirotin  wrote:
> If I understand right, the problem is that you want the signal after
> all related fields are already saved. If so, this is exactly the
> problem I have too.
> You see, when you have such a relation (and, for example, edit the
> parent object with inlined related objects from the admin page, Django
> _has to_ save the parent object first, and only then it saves the
> related objects (you can verify it by adding print statements to your
> save methods or handlers and running the dev server from terminal).
> The reason is that when you initially create the object, related
> objects have to link to the existing object, so the parent object is
> saved before them.
>
> On Jul 13, 9:27 pm, Ryan K  wrote:
>
>
>
> > Recently I've been trying to get answers about the post_save signal
> > behavior and perhaps have been asking too much of readers without
> > narrowing down the problem enough myself. So here is my effort to ask
> > a rather straightforward question:
>
> > The code that connects to the post_save signal, according to the
> > signal docs, is passed three objects and I am only concerned about
> > one: the instance that was saved. Now this instance has a
> > ManyToManyField and what I am finding out according to be debugging is
> > that the instance's ManyToMany field is NOT being updated after save
> > is called.
>
> > So, for example, when the signal calls the handler (this is being done
> > via the admin interface but it shouldn't matter) and I check
> > instance.manytomanyfield, it does not show the most recent changes.
> > What is the best way to "force" the update of the table so I can get
> > accurate data from the ManyToMany field? Even if I explicitly do
> > something like this:
>
> >     def __init__(self, sender, instance):
> >         self.sender = sender
> >         self.instance = sender.objects.select_related().get
> > (id=instance.id)
>
> > What seems like cached data is being when I test:
>
> > self.instance.manytomanyfield.all()
>
> > Can anyone help with this behavior?
>
> > Cheers,
> > Ryan
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: .views._CheckLogin.__call__ didn't return an HttpResponse object

2009-07-14 Thread alecs

I'm just calling another view mail_to_user(request,username,dummy) ,
which contains render_to_response!
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: .views._CheckLogin.__call__ didn't return an HttpResponse object

2009-07-14 Thread Ryan K

To be a little more explicit, perhaps your view code contains:

render_to_response('template.html",{},RequestContextInstance)

as opposed to

return render_to_response(...)

Cheers,
Ryan
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: .views._CheckLogin.__call__ didn't return an HttpResponse object

2009-07-14 Thread Ryan K

Are you returning render_to_response in the view?

On Jul 14, 6:12 am, alecs  wrote:
> Hi all :) Can u help me with .views._CheckLogin.__call__ didn't return
> an HttpResponse object . I'm trying from my view 'jump' to another
> view by calling     mail_to_user(request,username,dummy)       The
> mail_to_user view contains render_to_response and if I simply copy the
> contents of mail_to_user into main view everything works OK. But I
> think it's better to call another view than to copy a whole conent.
> What can be wrong ?
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



.views._CheckLogin.__call__ didn't return an HttpResponse object

2009-07-14 Thread alecs

Hi all :) Can u help me with .views._CheckLogin.__call__ didn't return
an HttpResponse object . I'm trying from my view 'jump' to another
view by calling mail_to_user(request,username,dummy)   The
mail_to_user view contains render_to_response and if I simply copy the
contents of mail_to_user into main view everything works OK. But I
think it's better to call another view than to copy a whole conent.
What can be wrong ?
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: AttributeError when trying to save and access models

2009-07-14 Thread Daniel Roseman

Sorry, to answer your second question:

On Jul 14, 10:56 am, Daniel Roseman  wrote:
> On Jul 14, 8:09 am, Sam Walters  wrote:

> > And if i try to see an attribute in another table:
>
> >  var = dirdir.admin.abbrev #error: 'DirectoryAdmin' object has no attribute
> > 'name'
>
Both abbrev and name live on the DirectoryType model, not the
DirectoryAdmin one, so you can't refer to self.name in the __unicode__
method of DirectoryAdmin. I'm not at all sure how you wanted this to
work, since there's no direct relationship between directoryadmin and
directorytype.
--
DR.
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: apache + mod_python + svn

2009-07-14 Thread Bastien

ok my bad, I didn't realize that the structure of the project had
changed within the directory now that it is controlled by subversion
and of course at the root of the directory there is no settings file,
instead I have to go to the ultimate revision.

Thanks,
Bastien

On Jul 14, 11:43 am, Bastien  wrote:
> Hi,
>
> I know this is slightly off topic but such a common situation that I
> guess somebody has already run into it.
>
> I have just deployed my project on a remote debian server with apache
> and mod_python following the documentation and it just works very
> well.
>
> Now I need to use subversion to keep updating the project so I
> installed it via 'apt-get install subversion' and 'apt-get install
> libapache2-svn'. That's where I made a mistake because I'm only using
> svn via ssh so I did not need that apache mod.
>
> What happened is that when installing libapache2-svn my apache config
> files were modified and I was asked to restart the server and suddenly
> I was granted with a mod_python error instead of my home page.
>
> If anybody can spot what is wrong or knows what files have been
> changed so I can change them back that would be of great help. Here is
> the error message if is of any relevance:
>
> MOD_PYTHON ERROR
>
> ProcessId:      23452
> Interpreter:    '78.XX.XX.XX' <- my public IP
>
> ServerName:     '78.XX.XX.XX'
> DocumentRoot:   '/var/www/'
>
> URI:            '/'
> Location:       '/'
> Directory:      None
> Filename:       '/var/www/'
> PathInfo:       ''
>
> Phase:          'PythonHandler'
> Handler:        'django.core.handlers.modpython'
>
> ImportError: Could not import settings 'settings' (Is it on sys.path?
> Does it have syntax errors?): No module named settings
>
> One last thing the path of the project has changed but I updated it in
> the apache2/sites-available/default and restarted apache.
>
> Thank you,
> Bastien
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: AttributeError when trying to save and access models

2009-07-14 Thread Daniel Roseman

On Jul 14, 8:09 am, Sam Walters  wrote:
> Hi Django world
> I keep getting problems accessing and storing data in foreignkey and
> one-to-one relationships.
> Error is basically of the form:
>  "AttributeError
> Exception Value: 'DirectoryAdmin' object has no attribute 'abbrev'"
>
> The models.py file is here:http://pastebin.com/mcc4ee45
> The SQL it produces is here:http://pastebin.com/m5b70bce5
>
> I don't think the problem is in here but you can see what I am trying to
> achieve. At the moment i am just trying to save multiple records in 'class
> DirectoryType' which relate through a foreignkey to Directory.
>
> MAIN CULPRIT:
> Views.pyhttp://pastebin.com/m10eac87f
>
> I seem to be able to .save() new instances of Directory, DirectoryAdmin,
> DirectoryType
>
> However i cant get Directory to associate with multiple instances of
> DirectoryType or even DirectoryAdmin.
> At a more fundamental level the .add() method says:
>
> 'DirectoryType' object has no attribute 'add'
>
> And if i try to see an attribute in another table:
>
>  var = dirdir.admin.abbrev #error: 'DirectoryAdmin' object has no attribute
> 'name'
>
> However i seem to be able to access the database for id's.
> var = dirdir.admin.id #works
>
> Any help would be greatly appreciated as i dont know what is going wrong
> beyond this.

I think you have misunderstood how foreign key fields work. The  model
that declares a ForeignKey field is the *many* side of the 1-to-many
relationship - ie the way you have it, each Directory has a single
DirectoryType, and a DirectoryType has multiple Directories.

If this is right, the misunderstanding is how you then set each side
of the relationship. From a Directory, you just do dir.directoryType =
x where x is a DirectoryType instance. But that does mean your loop
doesn't make sense.

However if you do want mulitple directorytypes for each directory, the
foreignkey field needs to live on the directorytype, and you would
then do dir.directorytype_set.add(x).

--
DR.
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



apache + mod_python + svn

2009-07-14 Thread Bastien

Hi,

I know this is slightly off topic but such a common situation that I
guess somebody has already run into it.

I have just deployed my project on a remote debian server with apache
and mod_python following the documentation and it just works very
well.

Now I need to use subversion to keep updating the project so I
installed it via 'apt-get install subversion' and 'apt-get install
libapache2-svn'. That's where I made a mistake because I'm only using
svn via ssh so I did not need that apache mod.

What happened is that when installing libapache2-svn my apache config
files were modified and I was asked to restart the server and suddenly
I was granted with a mod_python error instead of my home page.

If anybody can spot what is wrong or knows what files have been
changed so I can change them back that would be of great help. Here is
the error message if is of any relevance:

MOD_PYTHON ERROR

ProcessId:  23452
Interpreter:'78.XX.XX.XX' <- my public IP

ServerName: '78.XX.XX.XX'
DocumentRoot:   '/var/www/'

URI:'/'
Location:   '/'
Directory:  None
Filename:   '/var/www/'
PathInfo:   ''

Phase:  'PythonHandler'
Handler:'django.core.handlers.modpython'

ImportError: Could not import settings 'settings' (Is it on sys.path?
Does it have syntax errors?): No module named settings

One last thing the path of the project has changed but I updated it in
the apache2/sites-available/default and restarted apache.

Thank you,
Bastien
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Object attributes in change_form.html

2009-07-14 Thread janedenone

On Jul 13, 10:05 pm, janedenone  wrote:
> On Jul 13, 6:07 pm, Daniel Roseman  wrote:
>
>
>
>
>
> > On Jul 13, 4:02 pm, janedenone  wrote:
>
> > > Hi,
>
> > > I read the documentation on customizing admin templates, but I still
> > > wonder how to access the object attributes in the change_form.html. I
> > > am capable of getting the id using {{ object_id }}:
>
> > > {% if change %}{% if not is_popup %}
> > >   
> > >      > > class="historylink">{% trans "View Calculation" %}
> > > ...
>
> > > but I need to access a couple of other attributes. {{ object_name }}
> > > does not work, nor does {{ object_cottage_name}} for getting a related
> > > object's name.
>
> > > Thankful for any hint.
>
> > > - Jan
>
> > The syntax for looking up attributes - in templates just like in
> > Python - is a dot, not an underscore. So you should use object.name,
> > etc.
>
> Many thanks, but that does not work either.
>
> - Jan

PS. I was using {{ object_id }} because this worked in the
object_tools block. "object" does not seem to be the object modified
via change_form.html, though.
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Error: ce is not defined

2009-07-14 Thread Joost Cassee

On Jul 14, 1:53 am, Sonal Breed  wrote:

> I am trying to add django-tinymce-1.5 in my application.
> I downloaded tinymce_3_2_5 and installed it using sudo python setup.py
> install.
>
> In my settings I have following:
> [...]
> INYMCE_JS_URL = MEDIA_URL + 'js/tiny_mce/tiny_mce.js'
> TINYMCE_JS_ROOT = MEDIA_ROOT + 'js/tiny_mce'

I'm assuming that these paths are correct.

> TINYMCE_COMPRESSOR = True

You could disable the compressor to aid debugging.

Everything looks okay at first glance.

> But i do not get the tinymce toolbar, in Firebug I get following
> tinymce is not defined at
>
> start : function() {
>  var t = this, each = tinymce.each, s = t.settings, ln =
> s.languages.split(',');
> This is compressor, i believe.

It seems the TinyMCE Javascript has not been rendered correctly.

Maybe the compressor could not find all files?

> Can anybody tell me what is it that I am doing wrong or is there
> anything that I am missing.

Could you show the generated Javascript?

Regards,

Joost
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: html file (UTF-8) generated from template does not displayed correctly using MS internet explorer 6.0

2009-07-14 Thread Eugene Mirotin

Most probably your html is incorrect, but FF is smart enough to handle
it.
Try the following:
* switch to the Strict XHTML instead of Transitional (as the latter is
not recommended)
* create a static HTML file (replace the remplate logic with some
dummy values) with the desired layout
* validate it using the w3c validator

I expect your file to have some validation errors. After you fix them,
update the template according to your fixes.

On Jul 14, 7:57 am, kk  wrote:
> I have these lines in my template file "base.html", and save the
> template file as "utf-8" format as I want to support Chinese
> characters.
>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;>
> http://www.w3.org/1999/xhtml;>
>
> My amzing site
> 
>  rel=stylesheet>
> .style1 {
>         COLOR: #ff}
>
> 
> 
>
> I type "python manage.py" to start web service.
> When I used MS IE6.0 to visit my server, the output web page displayed
> quite strange ( the main content does not appear in the center of the
> webpage).
> But  the webpage displayed correctly when I used Firefox.
> I examined the generated webpage and found nothing abnormal.
>
> However, strange things happened when I downloaded the webpage to my
> local directory("D:\file\") from "127.0.0.1:8000".
> If I downloaded the webpage using firefox, everything worked fine.
> But if I used MS IE6.0, the downloaded webpage lost the html header
> dtd declaration
>            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
> If I open the webpage from my local directory ("D:\file\mysite.html"),
> it displayed also abnormally just like the same as I mentioned above.
> After I manually added the lost dtd declaration to ("D:\file
> \mysite.html"), the webpage can displayed correctly as Firefox.
>
> My questions are:
> 1) why does my webpage displays not correctly using MS IE 6.0.
> 2) why does the dtd declaration get lost when I download the page to
> my local directory ("D:\file\").
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django admin for PHP?

2009-07-14 Thread Maksymus007

On Tue, Jul 14, 2009 at 10:00 AM, Bela Hausmann wrote:
>
> Hi everybody!
>
> I use django a lot, and I'm really glad about the admin interface. I
> always hated to code admin interfaces myself, never again :)
>
> But now I have the task of making a new corporate website with a PHP
> framework, and my question is, are there any frameworks, that have a
> django-like (= powerfull, automatic, model based, easy) admin
> interface/generater.
>
> I know about the symfony admin generator (which is not as easy as the
> django admin). Are there any more?
>
> I know this is kind of off-topic, but only django users know how
> powerful the django admin is, so I can't ask the PHP community.
>
> Best regards from Austria,
> Bela

Symphony, CakePHP

--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: url as folder path possible?

2009-07-14 Thread Eugene Mirotin

The problem is still unclear.
Do you want to handle the path example.com/some/path/ and route it to
some view that would get the 'some/path' as argument?
If so,
* write the url conf like r'^([\w_\/]+)/$', handle_path
* write the handle_path(request, path) view
* in view split the pass by slashes
* determine the object based on the path (using some getattr calls on
modules or objects)
* call the desired methods on the obtained object


On Jul 14, 4:22 am, theiviaxx  wrote:
> Sorry i didnt explain very well.  The folder objects are django
> objects, not file system paths
>
> On Jul 13, 6:19 pm, Almir Karic  wrote:
>
>
>
>
>
> > For real world deployment you should use your web server to do that.
> > For apache that would be an Alias (and make sure the Alias get's to be
> > served before everything is passed to django).
>
> > For development purposes you should have a look 
> > athttp://docs.djangoproject.com/en/dev/howto/static-files/
>
> > python/django hacker & sys 
> > adminhttp://almirkaric.com://twitter.com/redduck666
>
> > On Mon, Jul 13, 2009 at 5:39 PM, TheIvIaxx wrote:
>
> > > I tried searching but didnt really find much.
>
> > > Is there a way to set up a url conf to get a url of a folder path?
> > > Basically i have a site that has folder-ish objects that contain
> > > stuff.  However i cannot seem to find a way to get a url pattern to
> > > work.  how would i get:
>
> > >http://example.com/path/to/folder
>
> > > to work?
>
>
--~--~-~--~~~---~--~~
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.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



  1   2   >