Django admin upload image to few folders

2011-07-23 Thread Vusal Alishov
Hello, I want to upload image in django-admin interface to few
folders.
My models image field such: image =
models.ImageField(upload_to='images')
How can I do 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.



Re: Real Example

2011-07-23 Thread William Grisaitis
Thanks Peter!



On Jul 23, 2011, at 1:09 AM, Eyad Al-Sibai  wrote:

Thanks a lot! I appreciate it

On Sat, Jul 23, 2011 at 5:33 AM, Peter Murphy wrote:

> Eyad,
>
> Well, I'll be damned:
>
> http://www.djangosites.org/with-source/
>
> It's good etiquette to say "thank you" at this point. ;-)
>
> Best regards,
> Peter
>
> On Jul 23, 4:17 am, Phang Mulianto  wrote:
> > you better find books in amazon. .. many ready to learn for you..
> > On Jul 22, 2011 10:41 PM, "Shawn Milochik"  wrote:>
> On 07/22/2011 10:31 AM, Eyad Al-Sibai wrote:
> > >> Hi!
> >
> > >> I want a real example of complete django application with source code
> > >> to understand django better
> >
> > > 1. Search Google, github, and bitbucket.
> >
> > > 2. Read this:https://code.djangoproject.com/wiki/UsingTheMailingList
> >
> > > --
> > > 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.
> >
> >
> >
> >
> >
> >
> >
> >
>
> --
> 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.
>
>
 --
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.

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



Web development newbie

2011-07-23 Thread Riefers
I've spent the 10+ years developing serverside apps in java. I've
never done any web page developement. Someone recommended Django. Any
suggestions on where to start? Is Django too advanced for me if I've
never done web side developement?

-- 
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: Web development newbie

2011-07-23 Thread Paul Schewietzek
Some python knowledge is helpful, if not required.

Since you should know general programming architectures from java, I
recommend "Dive into Python" to learn python.

http://diveintopython.org/



2011/7/23 Riefers 

> I've spent the 10+ years developing serverside apps in java. I've
> never done any web page developement. Someone recommended Django. Any
> suggestions on where to start? Is Django too advanced for me if I've
> never done web side developement?
>
> --
> 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.
>
>

-- 
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: Web development newbie

2011-07-23 Thread jocke khazad
HI,

To have some knowlege of python is of course helpful but I think you can
learn to write django applications quite fast starting with Djangos own
tutorial since you have programming knowlege form another language.

https://docs.djangoproject.com/en/dev/intro/tutorial01/

Good luck!

On Sat, Jul 23, 2011 at 3:29 PM, Paul Schewietzek
wrote:

> Some python knowledge is helpful, if not required.
>
> Since you should know general programming architectures from java, I
> recommend "Dive into Python" to learn python.
>
> http://diveintopython.org/
>
>
>
>
> 2011/7/23 Riefers 
>
>> I've spent the 10+ years developing serverside apps in java. I've
>> never done any web page developement. Someone recommended Django. Any
>> suggestions on where to start? Is Django too advanced for me if I've
>> never done web side developement?
>>
>> --
>> 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.
>>
>>
>  --
> 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.
>

-- 
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: Web development newbie

2011-07-23 Thread Furqan Rauf
One thing for sure you need to know some HTML + CSS as well I remember when
I started Django I had my application but the UI sucked bad so put the combo
on ur check list :D

On Sat, Jul 23, 2011 at 8:52 AM, jocke khazad  wrote:

> HI,
>
> To have some knowlege of python is of course helpful but I think you can
> learn to write django applications quite fast starting with Djangos own
> tutorial since you have programming knowlege form another language.
>
> https://docs.djangoproject.com/en/dev/intro/tutorial01/
>
> Good luck!
>
>
> On Sat, Jul 23, 2011 at 3:29 PM, Paul Schewietzek <
> tetsuo...@googlemail.com> wrote:
>
>> Some python knowledge is helpful, if not required.
>>
>> Since you should know general programming architectures from java, I
>> recommend "Dive into Python" to learn python.
>>
>> http://diveintopython.org/
>>
>>
>>
>>
>> 2011/7/23 Riefers 
>>
>>> I've spent the 10+ years developing serverside apps in java. I've
>>> never done any web page developement. Someone recommended Django. Any
>>> suggestions on where to start? Is Django too advanced for me if I've
>>> never done web side developement?
>>>
>>> --
>>> 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.
>>>
>>>
>>  --
>> 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.
>>
>
>  --
> 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.
>



-- 
*-Furqan Rauf*
*Do you love your creator? Love your fellow-beings first. -Prophet Muhammad
*
*http://www.amway.com/furqanrauf*

-- 
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: Web development newbie

2011-07-23 Thread Victor Manuel Quiñones Victor
Hi guys

I'm agree with those guys, no further python knowledge it is required to
start with django, but maybe in the future will be necesary to increase your
django skills.

good luck and enjoy django.

On Sat, Jul 23, 2011 at 11:04 AM, Furqan Rauf  wrote:

> One thing for sure you need to know some HTML + CSS as well I remember when
> I started Django I had my application but the UI sucked bad so put the combo
> on ur check list :D
>
>
> On Sat, Jul 23, 2011 at 8:52 AM, jocke khazad  wrote:
>
>> HI,
>>
>> To have some knowlege of python is of course helpful but I think you can
>> learn to write django applications quite fast starting with Djangos own
>> tutorial since you have programming knowlege form another language.
>>
>> https://docs.djangoproject.com/en/dev/intro/tutorial01/
>>
>> Good luck!
>>
>>
>> On Sat, Jul 23, 2011 at 3:29 PM, Paul Schewietzek <
>> tetsuo...@googlemail.com> wrote:
>>
>>> Some python knowledge is helpful, if not required.
>>>
>>> Since you should know general programming architectures from java, I
>>> recommend "Dive into Python" to learn python.
>>>
>>> http://diveintopython.org/
>>>
>>>
>>>
>>>
>>> 2011/7/23 Riefers 
>>>
 I've spent the 10+ years developing serverside apps in java. I've
 never done any web page developement. Someone recommended Django. Any
 suggestions on where to start? Is Django too advanced for me if I've
 never done web side developement?

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


>>>  --
>>> 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.
>>>
>>
>>  --
>> 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.
>>
>
>
>
> --
> *-Furqan Rauf*
> *Do you love your creator? Love your fellow-beings first. -Prophet
> Muhammad
> *
> *http://www.amway.com/furqanrauf*
>
>  --
> 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.
>



-- 
Quiñones Victor Manuel
Tel: +54 03722 684102
Resistencia - 3500
Argentina

-- 
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: Setting LOGIN_URL dynamically, for different users, based on app?

2011-07-23 Thread dpapathanasiou
That's interesting, I hadn't thought about using a hidden input for
next in the two login templates.

In the end, though, I went with just one login template.

And rather than use UserProfiles (since there were no additional
attributes I needed to attach to the default User model, and my two
user types were not related otherwise), I with Groups (https://
docs.djangoproject.com/en/dev/topics/auth/#groups) instead.

I.e., I created two groups, one for each type of user, and at signup,
assigned them to group A/B accordingly.

LOGIN_REDIRECT_URL was set to a view function that checked the Group
belonging to request.user, and dispatched to the right start page.

I also wrote a decorator for each view function in /dashboard and /
console, to check that the given request.user was eligible to invoke
the underlying function.

So far, in test, it does exactly what I need it to do, based on the
original design.

So, I'd like to say thank you to everyone who replied to this thread;
your suggestions were helpful, and I wouldn't have discovered the
Groups capability without them.

On Jul 22, 11:06 am, Alexey Luchko  wrote:
> On 22.07.2011 17:32, dpapathanasiou wrote:
>
> > So you're saying: have the function which handles the post-login
> > request (i.e., defined in with LOGIN_REDIRECT_URL in settings.py and
> > in urls.py to some corresponding views.py function) make that type
> > check of user A/B, and simply redirect accordingly?
>
> You can try redirect twice.  Set fixed LOGIN_REDIRECT_URL to a view that
> makes further redirect based on user permissions.
>
> Or you can try fixed hidden input next in the login templates.

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



writing function into the Manager or the Model

2011-07-23 Thread Eyad Al-Sibai
I am a little bit confused... what functions should I write it in the
Manager and what should be within the Model itself... Also what functions do
you think should be written inside the class Admin within the Model?


Regards,
Eyad

-- 
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: Static Files on IIS7

2011-07-23 Thread CrabbyPete
Have you got django to run on II7 at all. I tried it and was not able
to get it to work. If you did I'd love to try it and see what comes up
with it.

On Jul 22, 7:46 am, The Ape  wrote:
> Hi,
>
> I am running Django (1.3) with PyISAPIe (Python 2.6.6) on IIS7.
> I am using the Django tutorial pages as test sites. Now when I am
> trying to access the adminsite,
> the site is loaded without the static files (loaded via IIS7).
> When I use the Django development server the site is rendered
> perfectly.  Templates are found...
>
> Hope someone can help me.
>
> Thanks!
>
> my settings look like this:
>
> STATIC_ROOT = ''
> STATIC_URL = '/static/'
> ADMIN_MEDIA_PREFIX = '/static/admin/'
> STATICFILES_DIRS = (
> )
>
> STATICFILES_FINDERS = (
>     'django.contrib.staticfiles.finders.FileSystemFinder',
>     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
> #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
> )
>
> TEMPLATE_DIRS = (
>     "C:/PATH/Django Pages/templates".
> )
>
> My ISAPI config:
>
> from django.core.handlers.wsgi import WSGIHandler as DjangoHandler
> os.environ["DJANGO_SETTINGS_MODULE"] = "mysite.settings"
> os.environ["django.root"] = "/mysite"
>
> sys.path.append(r'C:\PATH\django')
> sys.path.append(r'C:\PATH\django\contrib\admin')
> sys.path.append(r'C:\PATH\Django Pages')
> sys.path.append(r'C:\PATH\Django Pages\mysite')
> sys.path.append(r'C:\PATH\Django Pages\mysite\polls')
> sys.path.append(r'C:\PATH\Django Pages\templates')
> sys.path.append(r'C:\PATH\Django Pages\static')
> ROOT_URLCONF = 'mysite.urls'

-- 
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: writing function into the Manager or the Model

2011-07-23 Thread Jani Tiainen
About methods in managers and models are described rather well in:
https://docs.djangoproject.com/en/1.3/topics/db/managers/#adding-extra-manager-methods

Putting Admin class inside models is deprecated about 3 years ago. You
should read
https://docs.djangoproject.com/en/dev/intro/tutorial02/#writing-your-first-django-app-part-2to
see how admin is done in recent versions of Django.

-- 

Jani Tiainen

On Sat, Jul 23, 2011 at 7:59 PM, Eyad Al-Sibai wrote:

> I am a little bit confused... what functions should I write it in the
> Manager and what should be within the Model itself... Also what functions do
> you think should be written inside the class Admin within the Model?
>
>
> Regards,
> Eyad
>
> --
> 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.
>

-- 
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: writing function into the Manager or the Model

2011-07-23 Thread Matt Mansour
Model methods are custom methods that add custom row level
functionality to your objects.

For example, if your model has a first_name field and a last_name
field, and you wanted to return the full name, your custom model
method could be:

class Person(models.Model):
 first_name = models.CharField(max_length=50)
 last_name = models.CharField(max_length=50)

 def full_name(self):
  return u'{0} {1}'.format (self.first_name, self.last_name)

In your view:

p = Person.objects.get(first_name='Mike', last_name='Smith')

To get the full name

p.full_name

Which returns:

u'Mike Smith'

On Sat, Jul 23, 2011 at 9:59 AM, Eyad Al-Sibai  wrote:
>
> I am a little bit confused... what functions should I write it in the Manager 
> and what should be within the Model itself... Also what functions do you 
> think should be written inside the class Admin within the Model?
>
> Regards,
> Eyad
>
> --
> 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.

-- 
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: Method call when deleting FK in admin

2011-07-23 Thread Jani Tiainen
Reason is that admin uses QuerySet.delete()
(https://docs.djangoproject.com/en/1.3/ref/models/querysets/#delete)

Note that deleting files while deleting models is dangerous: what happens if
deletion is aborted and rolled back for some reason? You have now deleted
files but instances stayed in a database. And you have lost data - and
created inconsistency on top of that all.

On Sat, Jul 23, 2011 at 12:07 AM, galgal  wrote:

>
>
> My models:class Spectacle(models.Model):
>
> title = models.CharField(max_length=100)
> slug = models.SlugField(max_length=100 unique=False)
> description = models.TextField()
> class SpectacleGallery(models.Model):
> spectacle = models.ForeignKey(Spectacle)
> image = models.ImageField(upload_to=upload_path_handler, max_length=255,
> help_text=_(u'tylko pliki z rozszerzeniem .jpg'))
> image_thumb = models.CharField(max_length=255, editable=False, blank=True,
> null=True)
> def delete(self, *args, **kwargs):
>
> image_thumb_abs = settings.MEDIA_ROOT + str(self.image_thumb)
>
> # try to delete thumb and image
>
> try:
>
> remove(image_thumb_abs)
>
> except Exception:
>
> pass
>
> try:
>
> self.image.delete()
>
> except Exception:
>
> pass
>
> super(SpectacleGallery, self).delete(*args, **kwargs) # Call the "real"
> delete() method.
>
> #try to delete dir
>
> try:
>
> removedirs(settings.SPECTACLE_GALLERY_UPLOAD_PATH + str(self.spectacle_id))
>
> except:
>
> pass
>
>
> Now in admin, when I delete from SpectacleGallery file is being deleted
> from disk and DB properly. The problem is when I want to delete Spectacle.
> Deletion page is asking if i'm sure to delete Spectacle and all related
> images. I confirm and: all records from database are deleted. Unfortunately
> files from SpectacleGallery are not deleted.I paste print into delete()
> method in SpectacleGallery. Nothing shows so my question is: Why delete
> method is not called when deleting it in that way?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/6o66VmCVQqMJ.
> 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.
>

-- 
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: Web development newbie

2011-07-23 Thread bruno desthuilliers
On 23 juil, 15:19, Riefers  wrote:
> I've spent the 10+ years developing serverside apps in java. I've
> never done any web page developement. Someone recommended Django. Any
> suggestions on where to start? Is Django too advanced for me if I've
> never done web side developement?

I don't understand what you mean by "serverside apps" here - I mean,
Django IS for serverside applications, not client side (which would
require javascript).

But anyway: coming from Java, you'd better start with learning Python
itself (at least the tutorial), else you may be fooled by some use of
class attributes in Django (specially in models and forms). Also,
doing web developpement require at least a basic knowledge of the HTTP
protocol, and possibly HTML and CSS.


-- 
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: Web development newbie

2011-07-23 Thread Javier Guerra Giraldez
On Sat, Jul 23, 2011 at 3:03 PM, bruno desthuilliers
 wrote:
> I don't understand what you mean by "serverside apps" here - I mean,
> Django IS for serverside applications, not client side (which would
> require javascript).

There are other kinds of servers and clients besides web, you know.

Also, in deep-tiered servers (where Java is king) involve lots of
server work that isn't directly related to web pages, even if it
ultimately could result in some web activity.

-- 
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: Changes from 1.2.5 to 1.4 pre-alpha?

2011-07-23 Thread Rodney Topor
Many thanks Bruno and Jacob.

Rodney

-- 
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: Web development newbie

2011-07-23 Thread Doug the Webmaster

I went from JAVA to python and am now learning django.
Going from JAVA to python is not a big deal.
Most of the concepts are the same, the biggest difference
being that JAVA is strongly typed and python is weakly typed.
This just means a python object can be any type, it doesn't have to
be declared as an object of a certain class, it just has to be able to
do the stuff ( have the same interface ) that the code requires it to
at run time. Its more flexible but can lead to mistakes in the code.
Python also has some interesting structure below the class level like
sequences that makes it consistent and efficient. "Dive into Python"
is a good  way to learn this.
Python is a pleasure to code in . . . don't be afraid :-)
Django is mostly a very well designed framework,
though it does require some understanding of how web development works,
though mostly basic stuff. The only problem is that I think the django 
tutorial

and some other resources sort of assume that you are moving from some other
more traditional web development language like PHP/MySQL and moving up 
the ladder.
You just have to know the basic ideas of web development like the HTTP 
protocol,

nothing too complicated, but I'm not sure where you could find a short intro
that would get you up to speed without wasting lots of time.
There are some django video tutorials I found helpful that bring you through
making a site, and you may be able to infer all you need to know by 
seeing some examples

they are at:
http://showmedo.com/videotutorials/django
I tried JAVA web development before Django
I find Django much more intuitive easier to code in
Both JAVA and Django are for perfectionists,
only Django is for perfectionists with time deadlines :-)
good luck with the transition
Doug



On 7/23/2011 9:19 AM, Riefers wrote:

I've spent the 10+ years developing serverside apps in java. I've
never done any web page developement. Someone recommended Django. Any
suggestions on where to start? Is Django too advanced for me if I've
never done web side developement?



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



too many queries: populate template from model foreign key lookup

2011-07-23 Thread Gelonida N
Hi,

I try to populate a template from a Model with a ForeignKey element)
members of the foreign key element should be displayed.

If I understand correctly my first attempt resulted in one query for
fetching the entries from my first model and in one Query for each row
in order to look up the contents related to the foreign key.



I try to explain with a simple example.

### The Models 
class Composer(models.Model):
last_name  = models.CharField(max_length=20)
first_name = models.CharField(max_length=20)

class Song(models.Model):
title = models.CharField(max_length=20)
composer = models.ForeignKey(Composer)

# My Task ##
Now I want to populate a template with a list of songs and their composers


Intuitive lazy Solution with many queries
===

The view
---
songs = Song.objects.all()
return render_to_response('mytemplate.html', {'song_list' : songs })


The template
---
{% for song in song_list %}
{{ song.title }} by {{ song.composer.last_name }},
{{song.composer.first_name }} 
{% endfor %}


The problem
---
The problem here is, that django will perform one query to get the list
of songs and will then get perform one query per row in order to look up
the composer by his primary key.


I would prefer to  have one query with a join


The verbose solution
===

I  use values() in order to force the join upfront before rendiering in
the template


The view
-
songs = Song.objects.all().values('title', 'composer__last_name',
'composer__first_name')
return render_to_response('mytemplate.html', {'song_list' : songs })


The template
--
{% for song in song_list %}
{{ song.title }} by {{ song.composer__last_name }},
{{song.composer__first_name }} 
{% endfor %}




The problem
-

This seems to do what I like, however there is one tiny problem.

I have to list all members of both models in the values section.
This seems to be rather verbose and repetetive.


My Questions
==

1.) What is the recommended way to fill a template with values from a
model requiring one (or in my real example even two) joins.



2.) Is it possibe to perform a query and ask it to get ALL values from
the first model and to 'join' ALL values from a second model?
This would avoid having to manually retype all Model members in the
view-code


3.) Is there a way to perform a query with a join, but to receive
an object for each row (instead of receiving a dict with the 'flattened'
values containing double underscores as separators)

This would allow me to still use 'song.composer.last_name' in the
template but to avoid one query per template row



Thanks a lot for your suggestions or for clarifying my potential
misunderstandings of how Django works is supposed to be used.






-- 
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 & py2exe

2011-07-23 Thread Gelonida N
On 07/22/2011 04:15 PM, Alexey Luchko wrote:
> On 22.07.2011 02:59, Gelonida N wrote:
>> Another issue, that I had is trying to use django under windows with
>> py2exe.
>>
>> Management commands are no more found, as django would require the
>> python source code in order to find existing management commands.
>>
>> Perhaps there is an easy  work around, but I am not aware of one.
> 
> Same here.
> 
> I far as I can see it requires some changes to
> django/core/management/__init__.py
> 
> You could try a hack filling django.core.management._commands manually
> in your project's manage.py.
> 
> 
> But for a project's prototype I've just created a script that imports
> settings and then calls a manage command manually like that:
> from django.core.management.commands import syncdb
> syncdb.Command().execute()
> 
> 
I did the same for one  management command.
What's even worse is, that even standard management commands like
'syncdb' are  lost during the creation of py2exe of one doesn't
reregister them manually

The clean fix might be a rewrite of django/core/management/__init__.py


> -- 
> Best regards,
> Alexey.
> 


-- 
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: Looking for Django Developers in the Region of Vienna Austria

2011-07-23 Thread Kashif Ali
I am python django developer having almost 5 years of experience including 3
years of django experience. I have more than 200 hours odesk time as well.

Plz let me know if you have such kind of jobs for remote developer.

Sincerely,
Kashif


On Wed, Jul 13, 2011 at 2:38 AM, Robert Boulanger <
robert.boulan...@gmail.com> wrote:

> Hi Guys,
>
> we are looking for a Django Developer in the Region of Vienna, Austria.
>
> Starting with the end of August 2011, we need a freelancer Django/Python
> Developer for an international Company, in Vienna/Austria.
> The work will be on-site at the customers place, about 40 hours a week.
> We will pay around 65 Euros per hour, additional local sales tax (20 %).
> This job will be for 6 to 12 months eventually longer. Office place,
> computer and infrastructure comes from us.
> Payment every month.
> Working languages: German and English.
>
> If you are interested, please contact me via EMail at r...@me.com
>
> thanks for your interest
>
>
> Robert Boulanger
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/lGKw8zWV7zIJ.
> 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.
>



-- 
-Kashif

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



incorrect padding

2011-07-23 Thread NISA BALAKRISHNAN
TypeError at /waybill/deserialize/

Incorrect padding

Request Method: POST
Request URL:http://127.0.0.1:8000/waybill/deserialize/
Django Version: 1.3
Exception Type: TypeError
Exception Value:

Incorrect padding

Exception Location: /Library/Frameworks/Python.framework/Versions/2.7/
lib/python2.7/base64.py in b64decode, line 76
Python Executable:  /Library/Frameworks/Python.framework/Versions/2.7/
Resources/Python.app/Contents/MacOS/Python
Python Version: 2.7.2
Python Path:

['/Users/nisabalakrishnan/Documents/ETS/src',
 '/Users/nisabalakrishnan/Documents/ETS/eggs/djangorecipe-0.99-
py2.7.egg',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages',
 '/Users/nisabalakrishnan/Documents/ETS/eggs/zc.recipe.egg-1.3.2-
py2.7.egg',
 '/Users/nisabalakrishnan/Documents/ETS/eggs/zc.buildout-1.5.2-
py2.7.egg',
 '/Users/nisabalakrishnan/Documents/ETS/eggs/windmill-1.6-py2.7.egg',
 '/Users/nisabalakrishnan/Documents/ETS/eggs/coverage-3.5-py2.7.egg',
 '/Users/nisabalakrishnan/Documents/ETS/eggs/simplejson-2.1.6-
py2.7.egg',
 '/Users/nisabalakrishnan/Documents/ETS/src/django-audit-log',
 '/Users/nisabalakrishnan/Documents/ETS/eggs/
django_debug_toolbar-0.8.5-py2.7.egg',
 '/Users/nisabalakrishnan/Documents/ETS/eggs/django_extensions-0.6-
py2.7.egg',
 '/Users/nisabalakrishnan/Documents/ETS/eggs/django_rosetta-0.6.2-
py2.7.egg',
 '/Users/nisabalakrishnan/Documents/ETS/eggs/South-0.7.3-py2.7.egg',
 '/Users/nisabalakrishnan/Documents/ETS/eggs/
setuptools-0.6c12dev_r88846-py2.7.egg',
 '/Users/nisabalakrishnan/Documents/ETS/parts/instance',
 '/Users/nisabalakrishnan/Documents/ETS',
 '/Users/nisabalakrishnan/Documents/ETS/bin',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-
darwin',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-
mac',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-
mac/lib-scriptpackages',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-
tk',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-
old',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-
dynload',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages',
 'config',
 '/Users/nisabalakrishnan/Documents/ETS/src/ets/settings/..']

Server time:Sun, 24 Jul 2011 07:20:51 +0200
Traceback Switch to copy-and-paste view

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
site-packages/django/core/handlers/base.py in get_response

response = callback(request,
*callback_args, **callback_kwargs)

...
▶ Local vars
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
site-packages/django/contrib/auth/decorators.py in _wrapped_view

return view_func(request, *args, **kwargs)

...
▶ Local vars
/Users/nisabalakrishnan/Documents/ETS/src/ets/views.py in
deserialize

wb_serialized = un64unZip( wb_data )

what could be the possible error in the zipping method?

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