Catching the autogenerated admin post

2011-09-29 Thread bazaarsoft
Hello - I'm new to Django and love what I see so far. I have the need
to "catch" the admin post for one of my models: essentially, the model
contains a file and from the file I want to extract data for some of
the other model fields that are required for that particular model.
So, can I "break" into the admin form processing to get it or am I
just going to have to build my own forms?

Thanks - and sorry if this is covered in another post, I searched here
and in the docs and didn't seem to come up with anything.

jay

-- 
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 image upload

2011-10-06 Thread bazaarsoft
> Also, I'm confused whether upload_to should be set in settings.py or
> models.py

It's actually a mix - if you have MEDIA_ROOT defined in settings.py,
then it will use that as the first part of the path. Then, what you
pass in the upload_to field will be appended to that. So, in my case,
I have "MEDIA_ROOT = '/Users/storefiles/' in my settings.py folder,
and the upload_to param in my model set to 'pluginFiles/%Y/%m/%H/%M/'.
What ultimately happens, then, is that the file gets stored here:

/Users/storefiles/pluginfiles/2011/10/06/02/38/somefile.zip

So, you must have at least one of those set and the path must be fully
write enabled for whatever process is running your Django app. For my
testing, I just made /Users/storefiles writable by everyone since I
don't really care about securing that directory on my dev Mac.

jay

On Oct 6, 1:08 pm, Ian  wrote:
> I can't seem to get it working.  It won't let my sync the database
> with this code:
> image = ImageField(upload_to=None[, max_length=100, **options])
>
> Also, I'm confused whether upload_to should be set in settings.py or
> models.py
>
> Thanks!
>
> On Oct 6, 6:11 am, BILLION Sébastien 
> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> >http://www.nitinh.com/2009/02/django-example-filefield-and-imagefield/
>
> > It the same for ImageField
>
> > BILLION S�bastien
>
> > the Answer to the ultimate question of life, the universe and everything
> > is 42
>
> >http://www.sebastienbillion.com/
>
> > Le 06/10/2011 05:22, Ian a �crit :
>
> > > Hey Everyone,
>
> > > I'm new to django, but I love it so far!
>
> > > I'm trying to figure out how to upload an image (restrict it to images
> > > only) and resave it as a different name.
> > > Eventually, I'll want to upload it to S3, but for now, I'm just
> > > testing it on my computer with runserver (so I'm not sure where it
> > > should be saving it).
>
> > > There are hundreds of tutorials for this online, but they are either
> > > outdated or more complex than I'm looking for.
>
> > > Right now, I have a template with the form in it.  I'm not sure where
> > > to go from there.
>
> > > Thanks so much!
> > > Sorry if this question is too basic!

-- 
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 image upload

2011-10-06 Thread bazaarsoft
Noticed a couple of typos in my reply:

> I have "MEDIA_ROOT = '/Users/storefiles/' in my settings.py folder,

file, not folder

> and the upload_to param in my model set to 'pluginFiles/%Y/%m/%H/%M/'.

is actually 'pluginFiles/%Y/%m/%d/%H/%M/'

jay

On Oct 6, 2:41 pm, bazaarsoft  wrote:
> > Also, I'm confused whether upload_to should be set in settings.py or
> > models.py
>
> It's actually a mix - if you have MEDIA_ROOT defined in settings.py,
> then it will use that as the first part of the path. Then, what you
> pass in the upload_to field will be appended to that. So, in my case,
> I have "MEDIA_ROOT = '/Users/storefiles/' in my settings.py folder,
> and the upload_to param in my model set to 'pluginFiles/%Y/%m/%H/%M/'.
> What ultimately happens, then, is that the file gets stored here:
>
> /Users/storefiles/pluginfiles/2011/10/06/02/38/somefile.zip
>
> So, you must have at least one of those set and the path must be fully
> write enabled for whatever process is running your Django app. For my
> testing, I just made /Users/storefiles writable by everyone since I
> don't really care about securing that directory on my dev Mac.
>
> jay
>
> On Oct 6, 1:08 pm, Ian  wrote:
>
>
>
>
>
>
>
> > I can't seem to get it working.  It won't let my sync the database
> > with this code:
> > image = ImageField(upload_to=None[, max_length=100, **options])
>
> > Also, I'm confused whether upload_to should be set in settings.py or
> > models.py
>
> > Thanks!
>
> > On Oct 6, 6:11 am, BILLION Sébastien 
> > wrote:
>
> > > Hi,
>
> > >http://www.nitinh.com/2009/02/django-example-filefield-and-imagefield/
>
> > > It the same for ImageField
>
> > > BILLION S�bastien
>
> > > the Answer to the ultimate question of life, the universe and everything
> > > is 42
>
> > >http://www.sebastienbillion.com/<http://www.sebastienbillion.com/>
>
> > > Le 06/10/2011 05:22, Ian a �crit :
>
> > > > Hey Everyone,
>
> > > > I'm new to django, but I love it so far!
>
> > > > I'm trying to figure out how to upload an image (restrict it to images
> > > > only) and resave it as a different name.
> > > > Eventually, I'll want to upload it to S3, but for now, I'm just
> > > > testing it on my computer with runserver (so I'm not sure where it
> > > > should be saving it).
>
> > > > There are hundreds of tutorials for this online, but they are either
> > > > outdated or more complex than I'm looking for.
>
> > > > Right now, I have a template with the form in it.  I'm not sure where
> > > > to go from there.
>
> > > > Thanks so much!
> > > > Sorry if this question is too basic!

-- 
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: No module named django after upgrade to os x Lion

2011-10-27 Thread bazaarsoft
Mac OS has always carried multiple Python installs. You can start
python using python2.5, python2.6, and on Lion python2.7. Those
installs are under /System/Library/Frameworks/Python.framework/ but
links to the executables are in /usr/bin/.

When you install Python packages, they get installed in /Library/
Python/VERSION#/site-packages/, so your django install is probably
under the 2.6 directory. Python 2.6 was the default python on Snow
Leopard - I believe Python 2.7 is the default on Lion and django isn't
installed in that directory which is why it stopped finding it.

Just FYI...

jay

On Oct 27, 8:30 am, angelika  wrote:
> Thanks, Tom. I see. So basically I need to reinstall Django, if I want
> to run it on Python 2.7.1, is that it?
>
> As far as I can tell, the older versions of Python are still installed
> on my machine. Does that mean that it might be possible to run an
> older version instead, and not have to reinstall Django? Can I run
> different versions of Python on the same machine, and just switch
> between the two?
>
> /Angelika
>
> On Oct 27, 11:28 am, Tom Evans  wrote:
>
>
>
>
>
>
>
> > On Thu, Oct 27, 2011 at 7:17 AM, angelika  wrote:
> > > Hello,
>
> > > I'm new to both Python and Django. A few months ago, I installed
> > > Django on my mac (running Snow Leopard). I took me quite some time,
> > > but I got it running. After that I didn't get around to doing anything
> > > with it. A few weeks ago, I upgraded my mac to run Lion and now, when
> > > I type import django in the python interpreter, it says No module
> > > named django.
>
> > > I found someone who had had a similar problem, and I'm guessing it
> > > could be connected to the fact that Lion comes with Python 2.7.1? My
> > > Django version is 1.2.5. Again, I know almost nothing about Python, so
> > > I could be way off base. Any ideas how I can solve this, or find out
> > > what the problem is?
>
> > > /Angelika
>
> > Python packages are installed for a specific minor version of python.
> > If you upgrade your minor version of python, then you will need to
> > reinstall all the python packages you use for that specific minor
> > version of python.
>
> > By 'minor version', I mean this: Python 2.7.1 has major version 2,
> > minor version 7 and minor minor version 1. You need to reinstall
> > whenever you change major or minor version.
>
> > Cheers
>
> > Tom

-- 
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.



User Profile Creation

2011-12-15 Thread bazaarsoft
In all the examples I've seen of creating the user profile at the time
a User is created, I always see the use of the signal and the profile
table's fields (except for user) have to be nullable. I don't see a
way to break in to the creation process using the signal scheme such
that you can pass in valid data for initial creation. I have all the
form elements for both the User object an my profile object - I just
can't get them to my version of the create_profile method.

Is this correct - a user profile can't have any required fields
(required in the model) except user because the only way to create it
is through the signal?

-- 
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.



Successful login to go back to the page login was initiated from

2011-12-16 Thread bazaarsoft
I have what appears to be an odd case - I have a login link on a bunch
of pages (logout if you're already logged in). What I want is to use
the built-in contrib.auth stuff to handle the login, but I want it to
take me back to the originating page once the user gets logged in
correctly. Unfortunately, I can't seem to find a single place to kick
the machine to make this happen. Is it possible with some simple
config or do I really have to implement my own forms/views?

-- 
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: Successful login to go back to the page login was initiated from

2011-12-16 Thread bazaarsoft
Never mind, found the answer:

http://efreedom.com/Question/1-806835/Django-Redirect-Previous-Page-Login

My Google-fu must be off today.

On Dec 16, 6:00 pm, bazaarsoft  wrote:
> I have what appears to be an odd case - I have a login link on a bunch
> of pages (logout if you're already logged in). What I want is to use
> the built-in contrib.auth stuff to handle the login, but I want it to
> take me back to the originating page once the user gets logged in
> correctly. Unfortunately, I can't seem to find a single place to kick
> the machine to make this happen. Is it possible with some simple
> config or do I really have to implement my own forms/views?

-- 
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.