Re: How good is Django's MySQL driver & its unicode support?

2009-08-14 Thread Torsten Bronger

Hallöchen!

Continuation writes:

> [...]
>
> Also one of the commenters of that blog post mentioned that
> unicode support has been removed from mysql-python. Is that true?
> Have you been able to store & retrieve unicode content in MySQL
> using Django?

For me it worked reliably.  However, I needed Unicode regular
expressions, which didn't work with MySQL (a known issue).

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
  or http://bronger-jmp.appspot.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: Database Store

2009-08-14 Thread Kenneth Gonsalves

On Saturday 15 Aug 2009 11:11:27 am Kannan wrote:
> i created that...Then i want to know how to get the input in a variable and
> store it in  database...

read up on ModelForm
-- 
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: Database Store

2009-08-14 Thread Kannan
i created that...Then i want to know how to get the input in a variable and
store it in  database...
With regards,

Kannan. R. P,



On Sat, Aug 15, 2009 at 11:03 AM, Kenneth Gonsalves
wrote:

>
> On Saturday 15 Aug 2009 11:00:30 am Kannan wrote:
> >  I am just learning Django now.I wanted to get the details like
> > DOB,Mobile No & more and want to store it in the Mysql Database..How can
> i
> > do that! Help Me..
>
> make a model, a view, an url and a template - possibly a form
> --
> 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: Database Store

2009-08-14 Thread Kenneth Gonsalves

On Saturday 15 Aug 2009 11:00:30 am Kannan wrote:
>  I am just learning Django now.I wanted to get the details like
> DOB,Mobile No & more and want to store it in the Mysql Database..How can i
> do that! Help Me..

make a model, a view, an url and a template - possibly a form
-- 
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
-~--~~~~--~~--~--~---



Database Store

2009-08-14 Thread Kannan
Hi Friends..
  I am just learning Django now.I wanted to get the details like
DOB,Mobile No & more and want to store it in the Mysql Database..How can i
do that! Help Me..

With regards,

Kannan. R. P,

--~--~-~--~~~---~--~~
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: Using glovar vars

2009-08-14 Thread Graham Dumpleton



On Aug 14, 10:13 pm, Jani Tiainen  wrote:
> Steve Patrick kirjoitti:
>
> > Hi everybody,
> > I´m new in Django and maybe my problem is a bit stupid...I would like
> > to use a global variable (for all the application) to store some info
>
> No you don't want to. And even it's possible in theory, you shouldn't
> even consider that option.
>
> > that I get in my firts page. I know I can send variables using
> > render_to_response, but is there any other easy way??is it possible to
> > define a global variable, initialize it in my first page and just use
> > it??
>
> Store value in session?
>
> First at all, your variable would only live time of request (meaning
> from the moment URL is parsed and reponse is sent to your browser). What
>   happens to your "global" after that? It wouldn't exist on next request.

That is not true.

Global variables at Python module scope will last for the life time of
the process.

That said, you must still be careful about using them because server
may be multiprocess and/or multithreaded, both of which causes issues
with doing it that way.

Have a read of:

  http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

as it says a bit about that.

Graham
--~--~-~--~~~---~--~~
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: Problem with getting setting up apache server for django

2009-08-14 Thread Graham Dumpleton



On Aug 14, 10:53 pm, NiJoMi  wrote:
> Installed Python 2.6.2 for all users and apache server failed to
> configure mod_wsgi, so I installed
> mod_wsgi-win32-ap22py26-3.0c4.so and renamed it mod_wsgi.so and apache
> configured the mod.
>
> however I am still getting 500 Internal Server Error
>
> testproject.lc-error.log
>
> [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1] mod_wsgi
> (pid=360): Exception occurred processing WSGI script 'E:/Django/
> testproject/apache/django.wsgi'.
> [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1] Traceback (most
> recent call last):
> [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]   File "C:\
> \Python26\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line
> 230, in __call__
> [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]
> self.load_middleware()
> [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]   File "C:\
> \Python26\\lib\\site-packages\\django\\core\\handlers\\base.py", line
> 33, in load_middleware
> [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]     for
> middleware_path in settings.MIDDLEWARE_CLASSES:
> [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]   File "C:\
> \Python26\\lib\\site-packages\\django\\utils\\functional.py", line
> 269, in __getattr__
> [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]     self._setup
> ()
> [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]   File "C:\
> \Python26\\lib\\site-packages\\django\\conf\\__init__.py", line 40, in
> _setup
> [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]
> self._wrapped = Settings(settings_module)
> [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]   File "C:\
> \Python26\\lib\\site-packages\\django\\conf\\__init__.py", line 75, in
> __init__
> [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]     raise
> ImportError, "Could not import settings '%s' (Is it on sys.path? Does
> it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
> [Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1] ImportError:
> Could not import settings 'testproject.settings' (Is it on sys.path?
> Does it have syntax errors?): No module named testproject.settings

Apache service runs as a special user, are your directories/files
actually readable to others. If they aren't Apache/mod_wsgi may not be
able to access them.

> 
> I have added
> ;C:\Python26;C:\Python26\Tools\Scripts
> to the end of  path in system variables
> and created the system variable PYTHONHOME  value=C:\Python26\Lib\site-
> packages\django

And what official documentation told you to do that. You should not
fiddle either of those. Doing so it just likely to cause problems,
although in this case, because Apache runs as special user, not likely
to stuff things up if you only did this for your own user specific
settings. Put it all back to what it was originally.

> 
> django.wsgi
>
> import os
> import sys
>
> sys.path.append('/usr/local/django')
> sys.path.append('/usr/local/django/testproject')

Above is wrong because that isn't where you have it installed.

> os.environ['DJANGO_SETTINGS_MODULE'] = 'testproject.settings'
> import django.core.handlers.wsgi
> application = django.core.handlers.wsgi.WSGIHandler()
> 
> I have tried
> sys.path.append('/E:/Django')
> sys.path.append('/E:/Django/testproject')

This is not a valid Windows path, shouldn't have a slash before drives
specifier.

> and
> sys.path.append('E:/Django')
> sys.path.append('E:/Django/testproject')

This looks okay and should work.

Did you restart Apache after making changes to be sure it was picked
up. Although WSGI script file will be reloaded when using mod_wsgi and
it is changed, if you have made a number of accumulated changes the
internal state of the interpreter could have been messed up.

> but I still get the error, something tells me I hav'nt grasped paths.
> --- 
> 
> testproject location:
> E:/Django/testproject
> ---
> django location
> C:\Python26\Lib\site-packages\django
> ---
> when I have this working I will post a tutorial for Python/Django
> dummies like myself.

Please do not go posting a tutorial. Half the problem is that people
who don't really understand what they are doing post their tutorials
and the net gets polluted with them and people can't find the real
documentation in the noise. End result is that they use some ones
partially inaccurate instructions and just get confused, as seems to
be the case for you.

Graham

> I can't thank you enough for all your help.
>
> On 14 Aug, 08:58, Graham Dumpleton  wrote:
>
>
>
> > Reinstall Python with latest Python 2.6 version and this time select
> > option that says 'install 

How to tidy up data returned by raw sql has u'blahblah'

2009-08-14 Thread adelaide_mike

My raw sql returns a list of data very nicely, except that character
cols have data surrounded by u'', and dates have datetime.date
(2009-01-01) etc.

In my newbie innocence I have not discovered how to remove these
extras.  Any clues?

Thanks

Mike
--~--~-~--~~~---~--~~
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 good is Django's MySQL driver & its unicode support?

2009-08-14 Thread Javier Guerra

Russell Keith-Magee wrote:
> I'm storing lots of unicode content, and I haven't seen any problems
> storing or retrieving that content.

same here.  my sites aren't so busy, but they do run continuously for months on 
RAM-limited VMs,  I'ts Ubuntu stock packages too.

All my text data on  MySQL is UTF-8 and haven't seen any problem at all.  maybe 
the leaky part isn't exactly the Unicode support but the translation between 
unicode and other encodings.  I always make sure that it's UTF-8 all the way, 
with no translation at any point (i don't see any value on latin1 or other 
limited kludges)

-- 
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: How good is Django's MySQL driver & its unicode support?

2009-08-14 Thread Russell Keith-Magee

On Sat, Aug 15, 2009 at 6:35 AM, Continuation wrote:
>
> I came upon this blog post:
> http://lucumr.pocoo.org/2009/1/8/the-sad-state-of-mysql-python
>
> It doesn't exactly have good things to say about mysql-python (aka
> MySQLdb) which I believe is the MySQL driver used by Django. Among
> other things memory leak was mentioned as a significant issue.
>
> If you use MySQL with Django, how is your experience with the MySQL
> driver? Any memory leak or other issues?

I've got several MySQL servers in production. I haven't seen any
memory leak problems from a site that does baseline traffic of 3-4
hits from the Google bot per second, 24-7, plus user traffic. This is
using the stock version of MySQLdb from Ubuntu 8.10.

> Also one of the commenters of that blog post mentioned that unicode
> support has been removed from mysql-python. Is that true? Have you
> been able to store & retrieve unicode content in MySQL using Django?

I'm storing lots of unicode content, and I haven't seen any problems
storing or retrieving that content.

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



Getting value from form in formset

2009-08-14 Thread ristretto.rb

Hi,  I fear that I just haven't found this in the docs yet.  But, here
goes

I'm using a formset to list out a number of text box fields.   The
initial number varies based on a couple of factors.  But, never
grows.

The formset has initial_values.  In the template, I have to preset the
values in a jQuery block.  I can look loop through the forms, and
print the html text boxes fine, but I don't know how to get the
integer value of the field, so I can set up the jQuery control.

I'm thinking I may have used this formset feature for the wrong
reason.  But, I wanted to get the validation, and other support.

Any thoughts?

thanks
Gene
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



ModelForm's is_valid() returns False, but I don't know why.

2009-08-14 Thread George Laskowsky
I have the following code (simplified):

# models.py

class Historico(models.Model):
 fechaCreacion = models.DateTimeField(auto_now_add=True)
 fechaModificacion = models.DateTimeField(auto_now=True)

class Meta:
abstract = True

class Categoria(Historico):
nombre =models.CharField(max_length = 20)
descripcion =   models.CharField(max_length = 50, blank = True,
verbose_name = 'descripción')

def __unicode__(self):
return self.nombre

class Meta:
ordering = ['nombre']

# forms.py

class CategoriaForm(forms.ModelForm):
class Meta:
model = Categoria

# views.py
[lots of code, variable 'data' is loaded with data from a file]
 form = CategoriaForm( initial=data , prefix=str(idx) )
 if form.is_valid():
[do something]
else:
   [do another thing]
[/lots of code]

The webpage shows the form populated with the data, BUT, is_valid() always
return false. I don't know what fails to validate, form.errors is empty.

Thanks!

P.S: thanks Margie for the last help.

-- 
George Laskowsky Ziguilinsky

--~--~-~--~~~---~--~~
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: ANN: Grappelli 2.0 prerelease

2009-08-14 Thread Russell Keith-Magee

On Fri, Aug 14, 2009 at 4:43 PM, patrickk wrote:
>
> The prerelease of Grappelli 2 is out now.

Just a quick suggestion - if you're going to go to the trouble of
announucing a pre-release, you might want to mention what Grappelli
_is_. Is it an application? A utility? A desert topping?

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



Formwizard and subforms

2009-08-14 Thread Gee

Hi,

I am trying to build a formwizard that includes a manytomany
relationship on one of the steps and I am stuck on to implement the
manytomany. The models are, (only for step in question)

class Person(models.Model):
  name = models.CharField
  addr   = models.ManyToMany(Phone)

class Phone(models.Model):
 PHONE_CHOICES(('H','Home'),('W",'Work'),('M','Mobile'))
 phone= models.CharField(max_length=10)
 phoneType = models.CharField(max_length=1, choices=PHONE_CHOICES)

The models are setup this way on the premise that more than one person
could have any number of the same phone numbers.

What I need to do is have a select box on the form that shows the
phone choices and when one is selected an option to add a new line to
the form that to retain that phone information for that type.

Any help would be greatly appreciated.

Thanks
Andrew

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



ManyToMany Model.py and the shell..

2009-08-14 Thread rh0dium

Hi Guys,

First post to the group I did do a search and came up dry.  I also own
the django book (Forcier,Bissex,Chun) and they don't explain how to do
this.  In short I can't figure out how to progmatically add a data via
a python shell script to the ManyToMay model..

--- models.py ---
from django.db import models
from django.contrib import admin

class Client(models.Model):
  client= models.CharField(max_length=256, primary_key=True)
  access= models.DateField()
  submitOptions = models.CharField(max_length=256)
  update= models.DateField()
  def __unicode__(self):
return str(self.client)
admin.site.register(Client)

class Change(models.Model):
  """This simply expands out 'p4 describe' """
  change= models.IntegerField(primary_key=True)
  client= models.ManyToManyField(Client)
  desc  = models.TextField()
  status= models.CharField(max_length=128)
  def __unicode__(self):
return str(self.change)
admin.site.register(Change)

Here is what I have which works but I don't know how to add the
ManyToMany.  I can't seem to figure out how to progmatically call it.
I know the row in SQL exists.

---  massImport.py ---

# Assume the client "clientspec" exists.  I know how to create that if
neeeded.

changes = [ { 'change': 123, 'desc': "foobar", status': "foobar",
client': "clientspec", }]

for item in changes:
  entry = Change(
change= item['change'],
desc= item['desc'],
status= item['status'],
# client= Client.objects.filter(client=item['client'])
)
  entry.save()

---  massImport.py ---


Can anyone show me where the error of my ways is.  I would really
appreciate it.

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: Newbie - question - Django Tutorials 2

2009-08-14 Thread salai

On Fri, Aug 14, 2009 at 11:22 PM, Léon Dignòn wrote:
>
> As it sais it's an indentation error. Instead you must write:
>>     inlines = [ChoiceInline]
>>     list_display = ('question','pub_date')  #line 16
>>
>>     admin.site.register(Poll, PollAdmin)
>

Thankyou. hmm.. It is strange.! ( indentation error)!

But, after restarting the server, my Polls APP is not in admin area
loaded. It always when I have an error message.

many thanks in advance,

regards,
koko






>
> On Aug 14, 10:53 pm, koko  wrote:
>> Dear All,
>>
>> I just start Django today and very enjoy with Django. I have some
>> trouble with Django Official Docs Tutorial 2 
>> fromhttp://docs.djangoproject.com/en/dev/intro/tutorial02/
>>
>> here is the error message. Can you help, what I do wrong here?
>>
>> IndentationError at /admin/
>> unexpected indent (admin.py, line 16)
>> Request Method: GET
>> Request URL:    http://localhost:8000/admin/
>> Exception Type: IndentationError
>> Exception Value:
>> unexpected indent (admin.py, line 16)
>> Exception Location:     /Library/Python/2.5/site-packages/django/utils/
>> importlib.py in import_module, line 35
>> Python Executable:      /System/Library/Frameworks/Python.framework/
>> Versions/2.5/Resources/Python.app/Contents/MacOS/Python
>> Python Version: 2.5.1
>>
>> Django version 1.2 pre-alpha.
>>
>> polls/admin.py
>>
>> from mysite.polls.models import Poll
>> from mysite.polls.models import Choice
>> from django.contrib import admin
>>
>> class ChoiceInline(admin.TabularInline):
>>     model = Choice
>>     extra = 3
>>
>> class PollAdmin(admin.ModelAdmin):
>>     fieldsets = [
>>         (None,               {'fields': ['question']}),
>>         ('Date information', {'fields': ['pub_date'], 'classes':
>> ['collapse']}),
>>     ]
>>     inlines = [ChoiceInline]
>>         list_display = ('question','pub_date')  #line 16
>>
>>         admin.site.register(Poll, PollAdmin)
>>
>> best regards,
>>
>> koko
> >
>

--~--~-~--~~~---~--~~
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: Don't understand ModelForm

2009-08-14 Thread ristretto.rb

What I'm doing now is

#  TEMPLATE
{% if modelform.instance.id %}
  
{% endif %}

#  The POST part of the view method

pk = request.POST.get('pk',None)
if pk:
  model = models.House.objects.get(pk=pk)
  modelform = forms.MyModelForm(request.POST, instance=house)
else:
  modelform = forms.MyModelForm(request.POST)

Anyone else use this approach?

gene

On Aug 15, 12:07 pm, "ristretto.rb"  wrote:
> This is an excellent thread.  I came here with the same questions as
> Marc.  My revelation seems to be that forms are for data, and saving
> is control.  And these two have separate concerns/goals.  Such that
> fields shouldn't be in forms for the sole reason to make control of
> the form function properly.
>
> So you can put the id in you forms with a hidden, or in the action=""
> attribute, or using some sort of JavaScript, or whatever.  So, I
> understand that the key should be controlled outside the scope of the
> Django form support.
>
> But, I wonder if something like {{ form_set.management_form }} for
> formsets could be used here.  Perhaps something like
> {{form.indentifier_key}} on a template in the form could by default
> write out a hidden field of the pk of the instance.  It would just be
> shorthand for putting the instance in the context, and typing  type="hidden" name="pk" value="{{instance.id}}"/>
>
> But, it could make your view work like this, so you don't have to
> query up the model instance yourself.
>
>   f = your_modelform(request.POST)
>   f.instance #  would be the read from the DB and set for you.
>
> Gene
>
> On Jul 22, 9:23 am, Shawn Milochik  wrote:
>
> > To expand on  what Dan said with a full (tested and working) example:
>
> > In urls.py:
>
> >      (r'^partner/$', 'partner_page'),
> >      (r'^partner/(?P\d+)/$', 'partner_page'),
>
> > In the form tag of your template:
> >      
>
> > The view:
>
> > @login_required
> > def partner_page(request, partner_id = None):
>
> >      if partner_id:
> >          #existing partner
> >          partner_instance = get_object_or_404(partner, pk = partner_id)
> >      else:
> >          #new partner
> >          partner_form = partnerForm()
> >          partner_instance = None
>
> >      if request.POST:
> >          post_data = request.POST.copy()
> >          partner_form = partnerForm(post_data, instance =  
> > partner_instance)
>
> >          if partner_form.is_valid():
> >              the_partner = partner_form.save()
> >              partner_id = the_partner.id
>
> >      template_file = 'partner.html'
>
> >      context = {
> >          'partner_form': partner_form,
> >          'partner_id': partner_id,
> >      }
>
> >      return render_to_response(template_file, context,  
> > RequestContext(request))
--~--~-~--~~~---~--~~
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: Don't understand ModelForm

2009-08-14 Thread ristretto.rb

This is an excellent thread.  I came here with the same questions as
Marc.  My revelation seems to be that forms are for data, and saving
is control.  And these two have separate concerns/goals.  Such that
fields shouldn't be in forms for the sole reason to make control of
the form function properly.

So you can put the id in you forms with a hidden, or in the action=""
attribute, or using some sort of JavaScript, or whatever.  So, I
understand that the key should be controlled outside the scope of the
Django form support.

But, I wonder if something like {{ form_set.management_form }} for
formsets could be used here.  Perhaps something like
{{form.indentifier_key}} on a template in the form could by default
write out a hidden field of the pk of the instance.  It would just be
shorthand for putting the instance in the context, and typing 

But, it could make your view work like this, so you don't have to
query up the model instance yourself.

  f = your_modelform(request.POST)
  f.instance #  would be the read from the DB and set for you.

Gene


On Jul 22, 9:23 am, Shawn Milochik  wrote:
> To expand on  what Dan said with a full (tested and working) example:
>
> In urls.py:
>
>      (r'^partner/$', 'partner_page'),
>      (r'^partner/(?P\d+)/$', 'partner_page'),
>
> In the form tag of your template:
>      
>
> The view:
>
> @login_required
> def partner_page(request, partner_id = None):
>
>      if partner_id:
>          #existing partner
>          partner_instance = get_object_or_404(partner, pk = partner_id)
>      else:
>          #new partner
>          partner_form = partnerForm()
>          partner_instance = None
>
>      if request.POST:
>          post_data = request.POST.copy()
>          partner_form = partnerForm(post_data, instance =  
> partner_instance)
>
>          if partner_form.is_valid():
>              the_partner = partner_form.save()
>              partner_id = the_partner.id
>
>      template_file = 'partner.html'
>
>      context = {
>          'partner_form': partner_form,
>          'partner_id': partner_id,
>      }
>
>      return render_to_response(template_file, context,  
> RequestContext(request))
--~--~-~--~~~---~--~~
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: using Max()

2009-08-14 Thread neridaj

Thanks again Karen.

On Aug 13, 7:40 pm, Karen Tracey  wrote:
> On Thu, Aug 13, 2009 at 5:01 PM, neri...@gmail.com wrote:
>
>
>
>
>
> > Hello,
>
> > Do I need t convert the value returned from Max() to an int, or am I
> > using it incorrectly? I'm getting this template error:
>
> > Caught an exception while rendering: (1064, "You have an error in your
> > SQL syntax; check the manual that corresponds to your MySQL server
> > version for the right syntax to use near ''id__max': '2'} )' at line
> > 1")
> > 1
>
> > from django.db.models import Max
>
> > def preview(request, template_name='listings/preview.html',
> > order_num=Order.objects.aggregate(Max('id'))):
>
> One problem here is that Order.objects.aggregate(Max('id')) is going to
> return a dictionary, not an integer.  You never pull the integer value out
> of the dictionary so your subsequent attempt to pass that dictionary as a
> filter value results in invalid SQL.
>
> Also, note that that aggregate call is going to be evaluated only once, when
> the function is defined at import time.  If you want that value to reflect
> Orders that have been created since the file containing this function was
> loaded, you need to move that code into the body of the function.
>
> Karen
>
> >    num = order_num
> >    user = request.user
> >    listings = Listing.objects.filter
> > (order__customer__user__username=user)
> >    gallery = Photo.objects.filter
> > (order__customer__user__username=user, order=num)
> >    return render_to_response(template_name, { 'user': user,
> > 'listings': listings, 'order': num, 'gallery': gallery })
>
> > Thanks,
>
> > Jason
--~--~-~--~~~---~--~~
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 much python do i need to know to learn/use Django?

2009-08-14 Thread snfctech

Thanks for the note on the functional programming part, Mike.  I've
been meaning to look into that.

On Aug 14, 10:01 am, Mike Ramirez  wrote:
> On Friday 14 August 2009 09:01:16 am Peter Herndon wrote:
>
>
>
> > I strongly disagree.  The thing to remember is that Django is just
> > Python applied to web programming.  Knowing Python better, and
> > understanding the quirks of the language and why they are there, will
> > serve you better when programming a Django app.  Django is a supremely
> > Pythonic approach to web applications (not the only such, to be sure).
> >  The framework developers use the language fluently.  The better you
> > understand the language, the easier you will find it to understand
> > Django.  The choices made in designing Django will be obvious, or at
> > least more clear than they would have been otherwise.
>
> > You are more likely to reach your goal of having a working Django site
> > sooner if you have a better understanding of the language than if you
> > concentrate on Django and skip the subtleties of the language.  Yes,
> > Python is designed to be easy to learn and easy to read, but
> > understanding the possibilities inherent in the language will help you
> > grasp more of Django more easily than if you just dive into web
> > programming.
>
> > Listen to the instructor, he's not wrong.
>
> > ---Peter Herndon
>
> I second this one and if you don't have any knowledge of functional
> programming, I would recommend adding this to your online education.
>
> Mike
>
> --
> "Kill the Wabbit, Kill the Wabbit, Kill the Wabbit!"
> -- Looney Tunes, "What's Opera Doc?" (1957, Chuck Jones)
>
>  signature.asc
> < 1KViewDownload
--~--~-~--~~~---~--~~
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 much python do i need to know to learn/use Django?

2009-08-14 Thread snfctech

@Peter:  Thanks for the dissenting opinion, Peter.  (And thanks for
the vote, Cliff.)

Actually, Peter, I find your points the most convincing of all.  But
especially in light of the fact that I've just discovered web2py, it
seems to make more sense for me to focus on getting a good grasp of
Python, rather than diving to quickly into Django.  I'm probably going
to have to evaluate both of these Python frameworks simultaneously.

On Aug 14, 9:13 am, "J. Cliff Dyer"  wrote:
> On Fri, 2009-08-14 at 08:30 -0700, snfctech wrote:
> > Thanks for all the helpful replies, django-users group!
>
> > I've got:
>
> > - Java and C++ coursework
> > - a little professional Java, Perl and Tcl/Tk experience (off and on
> > over several years)
> > - 1 year large Servoy project (like a Java based Filemaker)
> > - about 2 years full-time PHP (including one MVC project with
> > CodeIgniter)
>
> > I tried picking up the "Agile Web Development with Rails" book a
> > couple years ago (without studying Ruby).  I went through the demo app
> > well enough, but hobbled along with a first pet-project that left me
> > scratching my head a bit.  Maybe I just didn't put enough time into
> > it, or maybe it was like what TiNo (above) was saying - had problems
> > distinguishing between Ruby classes/conventions and the Rails ones,
> > which just added to my brain load and slowed me down when looking at a
> > page of Ruby/Rails code.
>
> > I spoke with the instructor of thePythonand Django courses, and he
> > said I should take thePythonand learn Django online, if I had to
> > choose (especially since my project may require deviation from the
> > Django ORM into SQLAlchemy, etc.).  My only reservation being that I
> > want to start using Django fast to actually build stuff.  And, it
> > sounds like you guys are saying that taking the Django course should
> > be okay since I have previous programming experience in other
> > languages (just brush up and take a book).
>
> > Normally I wouldn't even bother with programming bootcamps like this -
> > but we have an education budget available, and I imagine having a
> >Pythonor Django expert by my side for 5 days could be quite helpful
> > at times.
>
> > So, still not sure what I should do, but thanks for the tips.
>
> I would vote for taking thepythoncourse, and learning Django online.
> Mostly because the django docs are fantastic.
>
> Cheers,
> Cliff
--~--~-~--~~~---~--~~
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: digg style pagination

2009-08-14 Thread Benjamin Wohlwend

Hi,

On Aug 14, 8:54 pm, sniper  wrote:
> I am asking this because in the admin page, the list page uses digg
> style paging.

Like everything else that comes with Django, the admin app is open
source, so nothing stops you from having a peek. This particular
functionality can be found in django/contrib/admin/templatetags/
admin_list.py, line 28[1]. The template tag has some admin-specifics
in it, you'd have to copy the template tag and adjust it. Or, and this
is probably what David so eloquently suggested, you could use one of
the countless digg-style paginators for Django that float around the
net. I'm quite fond of this[2] one because it extends the built-in
pagination facilities instead of completely reinventing the wheel.

Kind regards,
Benjamin

[1] 
http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/templatetags/admin_list.py#L28
[2] http://www.djangosnippets.org/snippets/773/
--~--~-~--~~~---~--~~
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: Form Wizard won't proceed past the second step

2009-08-14 Thread Adam Olsen

On Fri, Aug 14, 2009 at 4:17 PM, Dustin wrote:
>
> Looks like you're not implementing the done() method required in
> FormWizard sub-classes.
> http://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/#creating-a-formwizard-class

It actually ended up being my CodeWidget being wonky, or some weird
assumptions that FormWizard makes, I'm not sure what's at fault here.

My CodeWidget class is trying to mimic the serial number entry for a
software product.  4 sets of 4 digits, here's the code:
http://dpaste.com/hold/80733/

It expects 4 different fields to be in the POST data, code_part0,
code_part1, code_part2, and code_part3.  value_from_datadict assembles
them into the full serial number, which looks something like this:

---

... which is what you get if you access form.cleaned_data['code']

This means that in the FormWizards sanity check at the end when it
tries to revalidate all the forms, it just passes
"code=---" into the form as the data instead of the 4
fields it's looking for, and the form no longer passes is_valid().

I made a simple check in value_from_datadict:

code = self.data.get(name, None)
if code: return code

I'm not sure if that's the correct way to go about it, but it's working for now.

-- 
Adam Olsen
SendOutCards.com
http://www.vimtips.org
http://last.fm/user/synic

--~--~-~--~~~---~--~~
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 good is Django's MySQL driver & its unicode support?

2009-08-14 Thread Continuation

I came upon this blog post:
http://lucumr.pocoo.org/2009/1/8/the-sad-state-of-mysql-python

It doesn't exactly have good things to say about mysql-python (aka
MySQLdb) which I believe is the MySQL driver used by Django. Among
other things memory leak was mentioned as a significant issue.

If you use MySQL with Django, how is your experience with the MySQL
driver? Any memory leak or other issues?

Also one of the commenters of that blog post mentioned that unicode
support has been removed from mysql-python. Is that true? Have you
been able to store & retrieve unicode content in MySQL using Django?

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: Form Wizard won't proceed past the second step

2009-08-14 Thread Dustin

Looks like you're not implementing the done() method required in
FormWizard sub-classes.
http://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/#creating-a-formwizard-class

On Aug 14, 11:29 am, Adam Olsen  wrote:
> I've got a FormWizard with two forms in it.  It validates the first
> form correctly, and proceeds onto the second form, but when I click
> submit for the second form, it does no validation and just jumps back
> to the first step.  I get no errors in this process.
>
> My urls.py looks like this:
>
> urlpatterns = patterns('sendoutcards.retail.views',
>     (r'^register/$', forms.RegistrationWizard()),
> )
>
> My FormWizard, two Forms, and the templates involved are here:
>
> http://dpaste.com/hold/80601/
>
> What am I doing wrong?
>
> --
> Adam Olsen
> SendOutCards.comhttp://www.vimtips.orghttp://last.fm/user/synic
--~--~-~--~~~---~--~~
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-tinymce not appearing in admin

2009-08-14 Thread diogobaeder

Kenneth,

Setting the Media nested class with the TinyMCE media worked! :-)

Thanks for the help, and sorry for the delay to answer your last post.

Diogo



On Aug 13, 5:28 am, diogobaeder  wrote:
> Hehehehe... indeed, it's a curious problem...
>
> Well, I'll try to stick to your posting suggestions, then. About the
> TinyMCE, I'm getting some errors, but it must be some typo
> somewhere... I'll post the results here when I make the changes.
>
> Thanks!
>
> Diogo
>
> On Aug 12, 9:27 pm, Kenneth Gonsalves  wrote:
>
> > On Wednesday 12 Aug 2009 9:35:30 pm diogobaeder wrote:
>
> > > Oops, sorry... it's version 1.1 final.
>
> > > I'll try to create the Media subclass with the media, then, although
> > > it's not specified in the django-tinymce use documentation.
>
> > > About dpaste, I'm confused, because in another post I pasted exception
> > > content and someone advised me to use dpaste to make the thread more
> > > readable. Are you really sure this is a recommendation for this list?
>
> > it is not a recommendation - it is my personal opinion. I have been flamed 
> > in
> > the past for both not posting enough of the error traceback and also for
> > posting too much of the error traceback. I have also been bitten in the
> > archives where the dpaste has expired. I suppose the best way would be to
> > paste the relevant lines of the traceback inline and the full traceback
> > somewhere else. But then one has to know which lines are relevant - and if 
> > one
> > does know that, usually one can solve the problem himself.
> > --
> > regards
> > kghttp://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: Newbie - question - Django Tutorials 2

2009-08-14 Thread Léon Dignòn

As it sais it's an indentation error. Instead you must write:
> inlines = [ChoiceInline]
> list_display = ('question','pub_date')  #line 16
>
> admin.site.register(Poll, PollAdmin)


On Aug 14, 10:53 pm, koko  wrote:
> Dear All,
>
> I just start Django today and very enjoy with Django. I have some
> trouble with Django Official Docs Tutorial 2 
> fromhttp://docs.djangoproject.com/en/dev/intro/tutorial02/
>
> here is the error message. Can you help, what I do wrong here?
>
> IndentationError at /admin/
> unexpected indent (admin.py, line 16)
> Request Method: GET
> Request URL:    http://localhost:8000/admin/
> Exception Type: IndentationError
> Exception Value:
> unexpected indent (admin.py, line 16)
> Exception Location:     /Library/Python/2.5/site-packages/django/utils/
> importlib.py in import_module, line 35
> Python Executable:      /System/Library/Frameworks/Python.framework/
> Versions/2.5/Resources/Python.app/Contents/MacOS/Python
> Python Version: 2.5.1
>
> Django version 1.2 pre-alpha.
>
> polls/admin.py
>
> from mysite.polls.models import Poll
> from mysite.polls.models import Choice
> from django.contrib import admin
>
> class ChoiceInline(admin.TabularInline):
>     model = Choice
>     extra = 3
>
> class PollAdmin(admin.ModelAdmin):
>     fieldsets = [
>         (None,               {'fields': ['question']}),
>         ('Date information', {'fields': ['pub_date'], 'classes':
> ['collapse']}),
>     ]
>     inlines = [ChoiceInline]
>         list_display = ('question','pub_date')  #line 16
>
>         admin.site.register(Poll, PollAdmin)
>
> best regards,
>
> koko
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Modification difference in Adm and user accounts

2009-08-14 Thread David

Hello,

Here is what I meet. In "Admin" account I can see all users' records.
If I modify a user's record, say "Peter", then I can see Peter's
modified record immediately if i refresh my browser.

However, If I login into "Peter" account (as a user) and do this
modification, then I can not see the new modified record immediately
no matter how many times I refresh my broswer. I need to wait a period
of time (3 or 5 minutes?) before I can see this modification.

This is the same browser. It's IE.

Anybody knows how to handle this problem?

Thanks so much.

--~--~-~--~~~---~--~~
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 - Django Tutorials 2

2009-08-14 Thread koko

Dear All,

I just start Django today and very enjoy with Django. I have some
trouble with Django Official Docs Tutorial 2 from
http://docs.djangoproject.com/en/dev/intro/tutorial02/

here is the error message. Can you help, what I do wrong here?

IndentationError at /admin/
unexpected indent (admin.py, line 16)
Request Method: GET
Request URL:http://localhost:8000/admin/
Exception Type: IndentationError
Exception Value:
unexpected indent (admin.py, line 16)
Exception Location: /Library/Python/2.5/site-packages/django/utils/
importlib.py in import_module, line 35
Python Executable:  /System/Library/Frameworks/Python.framework/
Versions/2.5/Resources/Python.app/Contents/MacOS/Python
Python Version: 2.5.1

Django version 1.2 pre-alpha.

polls/admin.py

from mysite.polls.models import Poll
from mysite.polls.models import Choice
from django.contrib import admin

class ChoiceInline(admin.TabularInline):
model = Choice
extra = 3

class PollAdmin(admin.ModelAdmin):
fieldsets = [
(None,   {'fields': ['question']}),
('Date information', {'fields': ['pub_date'], 'classes':
['collapse']}),
]
inlines = [ChoiceInline]
list_display = ('question','pub_date')  #line 16

admin.site.register(Poll, PollAdmin)

best regards,

koko

--~--~-~--~~~---~--~~
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: digg style pagination

2009-08-14 Thread sniper

You didn't understand my question... i am asking if there is a
django's built in functionality.
Google shows people making custom ones or extending paginator.

On Aug 14, 3:00 pm, David Zhou  wrote:
> http://tinyurl.com/mj29fw
>
> -- dz
>
>
>
> On Fri, Aug 14, 2009 at 2:54 PM, sniper wrote:
>
> > I am trying to do pagination. Just wanted to know if there is a
> > shortcut to show digg style pagination or i have to write my own?
> > I am asking this because in the admin page, the list page uses digg
> > style paging.
--~--~-~--~~~---~--~~
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: digg style pagination

2009-08-14 Thread David Zhou

http://tinyurl.com/mj29fw

-- dz



On Fri, Aug 14, 2009 at 2:54 PM, sniper wrote:
>
> I am trying to do pagination. Just wanted to know if there is a
> shortcut to show digg style pagination or i have to write my own?
> I am asking this because in the admin page, the list page uses digg
> style paging.
>
>
> >
>

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



digg style pagination

2009-08-14 Thread sniper

I am trying to do pagination. Just wanted to know if there is a
shortcut to show digg style pagination or i have to write my own?
I am asking this because in the admin page, the list page uses digg
style paging.


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



Display pictures located in MEDIA_ROOT ?

2009-08-14 Thread Katja

Hello,

I am storing some images in my MEDIA_ROOT and have now the problem
that I am not exactly sure how I can use them on webpages later on.

settings.py
MEDIA_ROOT = '/data/zooscan/'
MEDIA_URL = 'http://MYSERVER/mediafiles/'

In apache2.conf I added the following:
  
SetHandler None
  

  
SetHandler None
  

In url.py
(r'^mediafiles/(?P.*)$', 'django.views/static.serve',
{'document_root':settings.MEDIA_ROOT}),

So how do I know call my images?
I have tried various versions e.g.
http://MEDIA_URL/zooscan/profilepics/PIC.png

What am I missing?
Or am I completely on the wrong way?

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: Override __init__()

2009-08-14 Thread Léon Dignòn

Yeah! this is working very well!

Now my last question. How can I change the initial-value of first_name
and last_name I defined in my class (look at first post)? I have  to
do it in the __init__() because I need some values of instance.

Thanks

On Aug 14, 5:26 pm, Daniel Roseman  wrote:
> On Aug 14, 3:50 pm, Léon Dignòn  wrote:
>
> > Hi Emily,
>
> > thanks so far!
>
> > unfortunately this line:
>
> > > instance = getattr(kwargs, 'instance')
> > throws this error:
> > > Exception Value: 'dict' object has no attribute 'instance'
>
> > what next?
>
> That should be:
>
> instance = kwargs.get('instance')
> --
> 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
-~--~~~~--~~--~--~---



Good OneToOneField design?

2009-08-14 Thread John M

Hey everyone,

I'm trying to use the 1-1 fields, and love the examples and how it
works, once it's created.  However, I'm having trouble determining
when in my code to create the actual instance of the 1-1 object.

What I really want is for the save() method of the 'master' side of
the model to create the 1-1 record, and that's easy enough, but if I
then start putting the 1-1 model into the admin interface, it seems to
error out when I try saving new records in the admin interface.

Am I off in thinking the creation of the 1-1 record should be done in
the save() method or should it be somewhere else in a view?

What I'd love to hear are peoples examples of how they used 1-1 fields
and implemented them in their code.

Thanks so much

John Matthew
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Form Wizard won't proceed past the second step

2009-08-14 Thread Adam Olsen

I've got a FormWizard with two forms in it.  It validates the first
form correctly, and proceeds onto the second form, but when I click
submit for the second form, it does no validation and just jumps back
to the first step.  I get no errors in this process.

My urls.py looks like this:

urlpatterns = patterns('sendoutcards.retail.views',
(r'^register/$', forms.RegistrationWizard()),
)

My FormWizard, two Forms, and the templates involved are here:

http://dpaste.com/hold/80601/

What am I doing wrong?

-- 
Adam Olsen
SendOutCards.com
http://www.vimtips.org
http://last.fm/user/synic

--~--~-~--~~~---~--~~
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 much python do i need to know to learn/use Django?

2009-08-14 Thread Mike Ramirez
On Friday 14 August 2009 09:01:16 am Peter Herndon wrote:

> I strongly disagree.  The thing to remember is that Django is just
> Python applied to web programming.  Knowing Python better, and
> understanding the quirks of the language and why they are there, will
> serve you better when programming a Django app.  Django is a supremely
> Pythonic approach to web applications (not the only such, to be sure).
>  The framework developers use the language fluently.  The better you
> understand the language, the easier you will find it to understand
> Django.  The choices made in designing Django will be obvious, or at
> least more clear than they would have been otherwise.
>
> You are more likely to reach your goal of having a working Django site
> sooner if you have a better understanding of the language than if you
> concentrate on Django and skip the subtleties of the language.  Yes,
> Python is designed to be easy to learn and easy to read, but
> understanding the possibilities inherent in the language will help you
> grasp more of Django more easily than if you just dive into web
> programming.
>
> Listen to the instructor, he's not wrong.
>
> ---Peter Herndon
>

I second this one and if you don't have any knowledge of functional 
programming, I would recommend adding this to your online education. 


Mike

-- 
"Kill the Wabbit, Kill the Wabbit, Kill the Wabbit!"
-- Looney Tunes, "What's Opera Doc?" (1957, Chuck Jones)


signature.asc
Description: This is a digitally signed message part.


Re: Problem running django through fcgi on shared hosting

2009-08-14 Thread Oli Warner
If you're just trying to host stuff you're developing (for yourself) you
could host it locally, either just using the dev server or using a
lightweight server like lighttpd.

If you actually want to deploy the sites, I'm still no use... But Bluehost
do offer pro-rated refunds (if you're 2 months into a 12 month contract, you
get 10 months' worth back). The setup fee is non-refundable AFIAK.

I'll stop being useless, step back and let anybody who might actually know
how to fix this, fix it. Best of luck Jonas.

On Fri, Aug 14, 2009 at 5:11 PM, Jonas Obrist  wrote:

>
> Thing is I already got my bluehost account for other projects, so
> getting another host kills my budget. Also the contract is running for
> another good 10 months so switching now isn't an option either. I only
> recently started django coding, so now I have to use what I have... But
> I see what you mean.
>
> Oli Warner wrote:
> > I apologise in advance for a reply that isn't going to seem
> > immediately useful.
> >
> > Don't host django sites on shared systems that don't wont help users
> > host their sites with them. Seriously. I've tried both Dreamhost (did
> > it!) and Bluehost (failed miserably). You spend hours, if not days,
> > hacking around and you end up with something that is far from ideal.
> >
> > With a host that does care about Django, you copy your site onto their
> > server and it runs.
> >
> > If you can afford it ($10/month) I'd seriously suggest a low-end VPS.
> > They make life even easier.
> >
> > On Fri, Aug 14, 2009 at 5:02 PM, Jonas Obrist  > > wrote:
> >
> >
> > I try to get django (1.0.2) to run on a shared hosting (with python
> > 2.5.2) through fcgi (with flup 1.0.2).
> >
> > I've written a very simple app to test this:
> >
> > /myproject/settings.py: http://dpaste.com/80556/
> > /myproject/urls.py
> > :
> > http://dpaste.com/80557/
> > /myproject/home/views.py
> > :
> > http://dpaste.com/80558/
> >
> > I use this script to run it:
> >
> > django.fcgi: http://dpaste.com/80559/
> >
> > with the .htaccess:
> >
> > http://dpaste.com/80560/
> >
> > Problem: I get an error when calling the page (using
> > http://www.ojii.ch/projectsj/django.fcgi):
> >
> > Traceback (most recent call last):
> >  File "django.fcgi", line 9, in 
> >WSGIServer(WSGIHandler()).run()
> >  File
> >
> "/home1/ojiich/lib/python2.5/site-packages/flup-1.0.2-py2.5.egg/flup/server/fcgi.py",
> > line 114, in run
> >  File
> >
> "/home1/ojiich/lib/python2.5/site-packages/flup-1.0.2-py2.5.egg/flup/server/threadedserver.py",
> > line 84, in run
> >socket.error: (22, 'Invalid argument')
> >
> > Which of course raises a 500 error.
> >
> > Anyone got any ideas how to fix this? Been trying everything I could
> > think of and followed two different guides:
> > http://www.bluehostforum.com/showthread.php?t=715
> >
> http://alextreppass.co.uk/blog/2008/11/14/getting-django-working-on-bluehost/
> >
> > No success
> >
> > Jonas
> >
> >
> >
> >
> > >
>
>
> >
>

--~--~-~--~~~---~--~~
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: Is there a way to combine ifequal with ifequal/if?

2009-08-14 Thread Javier Guerra

On Fri, Aug 14, 2009 at 11:18 AM, realfun wrote:
> Hi,
> I have met the situation like "if A==B or A==C: doSomething...", or, "if
> A==B or C: doSomething..."
> I found it's hard to express in Django template, and small though, so no
> meaning to write it as a filter.

put the logic in the view function (or maybe in the model!) and hand a
simple boolean to the template


-- 
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: how much python do i need to know to learn/use Django?

2009-08-14 Thread J. Cliff Dyer

On Fri, 2009-08-14 at 08:30 -0700, snfctech wrote:
> Thanks for all the helpful replies, django-users group!
> 
> I've got:
> 
> - Java and C++ coursework
> - a little professional Java, Perl and Tcl/Tk experience (off and on
> over several years)
> - 1 year large Servoy project (like a Java based Filemaker)
> - about 2 years full-time PHP (including one MVC project with
> CodeIgniter)
> 
> I tried picking up the "Agile Web Development with Rails" book a
> couple years ago (without studying Ruby).  I went through the demo app
> well enough, but hobbled along with a first pet-project that left me
> scratching my head a bit.  Maybe I just didn't put enough time into
> it, or maybe it was like what TiNo (above) was saying - had problems
> distinguishing between Ruby classes/conventions and the Rails ones,
> which just added to my brain load and slowed me down when looking at a
> page of Ruby/Rails code.
> 
> I spoke with the instructor of the Python and Django courses, and he
> said I should take the Python and learn Django online, if I had to
> choose (especially since my project may require deviation from the
> Django ORM into SQLAlchemy, etc.).  My only reservation being that I
> want to start using Django fast to actually build stuff.  And, it
> sounds like you guys are saying that taking the Django course should
> be okay since I have previous programming experience in other
> languages (just brush up and take a book).
> 
> Normally I wouldn't even bother with programming bootcamps like this -
> but we have an education budget available, and I imagine having a
> Python or Django expert by my side for 5 days could be quite helpful
> at times.
> 
> So, still not sure what I should do, but thanks for the tips.
> 

I would vote for taking the python course, and learning Django online.
Mostly because the django docs are fantastic.

Cheers,
Cliff


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



Is there a way to combine ifequal with ifequal/if?

2009-08-14 Thread realfun
Hi,
I have met the situation like "if A==B or A==C: doSomething...", or, "if
A==B or C: doSomething..."

I found it's hard to express in Django template, and small though, so no
meaning to write it as a filter.

Current I did a redundancy way:

{%ifequal A B%}
blabla
{%else%}
{%ifequal A C%}
blabla
{%endifequal%}
{%endifequal%}

this is fare more complex than it should be, it even dup the code!

Is there an easy way or hidden feature that could make a simple 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: Problem running django through fcgi on shared hosting

2009-08-14 Thread Jonas Obrist

Thing is I already got my bluehost account for other projects, so 
getting another host kills my budget. Also the contract is running for 
another good 10 months so switching now isn't an option either. I only 
recently started django coding, so now I have to use what I have... But 
I see what you mean.

Oli Warner wrote:
> I apologise in advance for a reply that isn't going to seem 
> immediately useful.
>
> Don't host django sites on shared systems that don't wont help users 
> host their sites with them. Seriously. I've tried both Dreamhost (did 
> it!) and Bluehost (failed miserably). You spend hours, if not days, 
> hacking around and you end up with something that is far from ideal.
>
> With a host that does care about Django, you copy your site onto their 
> server and it runs.
>
> If you can afford it ($10/month) I'd seriously suggest a low-end VPS. 
> They make life even easier.
>
> On Fri, Aug 14, 2009 at 5:02 PM, Jonas Obrist  > wrote:
>
>
> I try to get django (1.0.2) to run on a shared hosting (with python
> 2.5.2) through fcgi (with flup 1.0.2).
>
> I've written a very simple app to test this:
>
> /myproject/settings.py: http://dpaste.com/80556/
> /myproject/urls.py
> :
> http://dpaste.com/80557/
> /myproject/home/views.py
> :
> http://dpaste.com/80558/
>
> I use this script to run it:
>
> django.fcgi: http://dpaste.com/80559/
>
> with the .htaccess:
>
> http://dpaste.com/80560/
>
> Problem: I get an error when calling the page (using
> http://www.ojii.ch/projectsj/django.fcgi):
>
> Traceback (most recent call last):
>  File "django.fcgi", line 9, in 
>WSGIServer(WSGIHandler()).run()
>  File
> 
> "/home1/ojiich/lib/python2.5/site-packages/flup-1.0.2-py2.5.egg/flup/server/fcgi.py",
> line 114, in run
>  File
> 
> "/home1/ojiich/lib/python2.5/site-packages/flup-1.0.2-py2.5.egg/flup/server/threadedserver.py",
> line 84, in run
>socket.error: (22, 'Invalid argument')
>
> Which of course raises a 500 error.
>
> Anyone got any ideas how to fix this? Been trying everything I could
> think of and followed two different guides:
> http://www.bluehostforum.com/showthread.php?t=715
> 
> http://alextreppass.co.uk/blog/2008/11/14/getting-django-working-on-bluehost/
>
> No success
>
> Jonas
>
>
>
>
> >


--~--~-~--~~~---~--~~
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: Problem running django through fcgi on shared hosting

2009-08-14 Thread Oli Warner
I apologise in advance for a reply that isn't going to seem immediately
useful.

Don't host django sites on shared systems that don't wont help users host
their sites with them. Seriously. I've tried both Dreamhost (did it!) and
Bluehost (failed miserably). You spend hours, if not days, hacking around
and you end up with something that is far from ideal.

With a host that does care about Django, you copy your site onto their
server and it runs.

If you can afford it ($10/month) I'd seriously suggest a low-end VPS. They
make life even easier.

On Fri, Aug 14, 2009 at 5:02 PM, Jonas Obrist  wrote:

>
> I try to get django (1.0.2) to run on a shared hosting (with python
> 2.5.2) through fcgi (with flup 1.0.2).
>
> I've written a very simple app to test this:
>
> /myproject/settings.py: http://dpaste.com/80556/
> /myproject/urls.py :
> http://dpaste.com/80557/
> /myproject/home/views.py:
> http://dpaste.com/80558/
>
> I use this script to run it:
>
> django.fcgi: http://dpaste.com/80559/
>
> with the .htaccess:
>
> http://dpaste.com/80560/
>
> Problem: I get an error when calling the page (using
> http://www.ojii.ch/projectsj/django.fcgi):
>
> Traceback (most recent call last):
>  File "django.fcgi", line 9, in 
>WSGIServer(WSGIHandler()).run()
>  File
>
> "/home1/ojiich/lib/python2.5/site-packages/flup-1.0.2-py2.5.egg/flup/server/fcgi.py",
> line 114, in run
>  File
>
> "/home1/ojiich/lib/python2.5/site-packages/flup-1.0.2-py2.5.egg/flup/server/threadedserver.py",
> line 84, in run
>socket.error: (22, 'Invalid argument')
>
> Which of course raises a 500 error.
>
> Anyone got any ideas how to fix this? Been trying everything I could
> think of and followed two different guides:
> http://www.bluehostforum.com/showthread.php?t=715
>
> http://alextreppass.co.uk/blog/2008/11/14/getting-django-working-on-bluehost/
>
> No success
>
> Jonas
>
> >
>

--~--~-~--~~~---~--~~
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 running django through fcgi on shared hosting

2009-08-14 Thread Jonas Obrist

I try to get django (1.0.2) to run on a shared hosting (with python 
2.5.2) through fcgi (with flup 1.0.2).

I've written a very simple app to test this:

/myproject/settings.py: http://dpaste.com/80556/
/myproject/urls.py: http://dpaste.com/80557/
/myproject/home/views.py: http://dpaste.com/80558/

I use this script to run it:

django.fcgi: http://dpaste.com/80559/

with the .htaccess:

http://dpaste.com/80560/

Problem: I get an error when calling the page (using 
http://www.ojii.ch/projectsj/django.fcgi):

Traceback (most recent call last):
  File "django.fcgi", line 9, in 
WSGIServer(WSGIHandler()).run()
  File 
"/home1/ojiich/lib/python2.5/site-packages/flup-1.0.2-py2.5.egg/flup/server/fcgi.py",
 
line 114, in run
  File 
"/home1/ojiich/lib/python2.5/site-packages/flup-1.0.2-py2.5.egg/flup/server/threadedserver.py",
 
line 84, in run
socket.error: (22, 'Invalid argument')

Which of course raises a 500 error.

Anyone got any ideas how to fix this? Been trying everything I could 
think of and followed two different guides:
http://www.bluehostforum.com/showthread.php?t=715
http://alextreppass.co.uk/blog/2008/11/14/getting-django-working-on-bluehost/

No success

Jonas

--~--~-~--~~~---~--~~
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 much python do i need to know to learn/use Django?

2009-08-14 Thread Peter Herndon

On Fri, Aug 14, 2009 at 11:39 AM, snfctech wrote:
>
> And I guess the answer to the title of the post, according to you guys
> is:
>
> "All you need is previous programming experience and a Python
> reference book.  Learning some Python basics before diving into Django
> is probably a good idea, but you don't need to spend weeks on it or
> take a bootcamp/course."

I strongly disagree.  The thing to remember is that Django is just
Python applied to web programming.  Knowing Python better, and
understanding the quirks of the language and why they are there, will
serve you better when programming a Django app.  Django is a supremely
Pythonic approach to web applications (not the only such, to be sure).
 The framework developers use the language fluently.  The better you
understand the language, the easier you will find it to understand
Django.  The choices made in designing Django will be obvious, or at
least more clear than they would have been otherwise.

You are more likely to reach your goal of having a working Django site
sooner if you have a better understanding of the language than if you
concentrate on Django and skip the subtleties of the language.  Yes,
Python is designed to be easy to learn and easy to read, but
understanding the possibilities inherent in the language will help you
grasp more of Django more easily than if you just dive into web
programming.

Listen to the instructor, he's not wrong.

---Peter Herndon

--~--~-~--~~~---~--~~
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: admin problems with the docu

2009-08-14 Thread Karen Tracey
On Fri, Aug 14, 2009 at 4:15 AM, quant  wrote:

>
> hi
>
> so i read and tryed all your idears here, but nothing of these is
> working... i'am running Django version 1.0.2 final
>
> and my settings.py is looking like this:
>
> http://dpaste.com/80427
>
> and my urls.py ist this:
>
> http://dpaste.com/80430
>
> hope anyone see the problem going on here
>
> ans thanks to all who help me
>

OK, so you've made some changes.  Are you saying that has had absolutely no
effect on the results?  "nothing of these is working" doesn't really tell us
if anything has changed or if you are still just not getting what you were
expecting.

Your previous debug information showed that admindocs was not listed in
INSTALLED_APPS, now that it is there you should, at a minimum, be getting
different debug information.  Also, attempting to go to /admin/ should now
take you to the admin main page and should not be resulting to any attempt
to render an admin docs template.

If indeed you are seeing no difference then somehow these changes you have
made are not being used.  Are you using the development server?  Apache?
Something else?

If you are seeing something different if would help people help you if you
would share details of the behavior you are seeing now.

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: how much python do i need to know to learn/use Django?

2009-08-14 Thread Oli Warner

I'd take the Django course.

Python is possibly one of the easiest languages to step into. You will
see new constructs, you will see funny-looking methods of doing things,
but they all make relative sense.

I would suggest going out and getting the Python Pocket Reference
(O'Reilly - Mark Lutz).

It's a tiny book but you can seriously learn all the Python you'll need
to develop Django apps just flicking through it when you need to know
something.

Having a window into #python or #django on freenode might be an idea too
=)



On Thu, 2009-08-13 at 18:08 -0700, snfctech wrote:
> I currently know zero Python and want to start a project with Django
> ASAP.  I've got the opportunity through my work to either take a 5-day
> Python bootcamp or a Django bootcamp - not both.
> 
> I don't anticipate having a whole bunch of time to brush up on Python
> before the Django class - but is that necessary?  How much Python do I
> need to know before learning/using Django?  Would a little brush up on
> Python + intensive Django be okay?  Or should I use my resources for
> intensive Python and then use online tutorials/ books for Django?
> 
> Also important to note:  The project I want to start may involve using
> SQLAlchemy and/or Elixir if the Django ORM doesn't support multiple
> database connections in time.
> 
> Thanks for the tips.
> > 



--~--~-~--~~~---~--~~
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: Portal Apps

2009-08-14 Thread J. Cliff Dyer

Yes.  That is a fair assumption.

On Fri, 2009-08-14 at 10:09 -0400, Joshua Williams wrote:
> Quick question in regards to building portable apps:  Should an  
> application rely on the app being on the PYTHONPATH to work properly?   
> That is, is having a app directory on the PYTHONPATH so common, is  
> should just be assumed this is done when you install a new app?
> 
> -Josh
> 
> > 


--~--~-~--~~~---~--~~
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: admin running in dev mode (manage.py runserver) ignores MEDIA_URL

2009-08-14 Thread physicsnick

You have to use the --adminmedia option to runserver; there's no other
way. Even if you serve the media yourself, the admin media overrides
your urls.py. The developers seem to have stopped listening to
complaints about fixing this:

http://code.djangoproject.com/ticket/8336



On Aug 14, 5:16 am, Aljosa Mohorovic 
wrote:
> settings.py:
> MEDIA_ROOT = "%s/media" % PROJECT_ROOT # set to media folder in
> project root
> MEDIA_URL = '/media/'
> ADMIN_MEDIA_PREFIX = '/media/admin/'
>
> urls.py
> if settings.DEBUG:
>   urlpatterns += patterns('',
>     (r'^media/(?P.*)$', 'django.views.static.serve',
> {'document_root': settings.MEDIA_ROOT, 'show_indexes':True}),
>   )
>
> example:
> PROJECT_ROOT/media/admin/img/admin/default-bg.gif exists but
> PROJECT_ROOT/env/lib/python2.6/site-packages/django/contrib/admin/
> media/img/admin/default-bg.gif is used instead.
>
> when i use mod_wsgi to run this instead of manage.py runserver it
> works as expected.
>
> anybody knows how to force django admin when running in dev mode
> (manage.py runserver) to use images from MEDIA_URL and not images in
> django/contrib/admin/media?
>
> Aljosa Mohorovic
--~--~-~--~~~---~--~~
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 much python do i need to know to learn/use Django?

2009-08-14 Thread snfctech

And I guess the answer to the title of the post, according to you guys
is:

"All you need is previous programming experience and a Python
reference book.  Learning some Python basics before diving into Django
is probably a good idea, but you don't need to spend weeks on it or
take a bootcamp/course."

On Aug 14, 8:30 am, snfctech  wrote:
> Thanks for all the helpful replies, django-users group!
>
> I've got:
>
> - Java and C++ coursework
> - a little professional Java, Perl and Tcl/Tk experience (off and on
> over several years)
> - 1 year large Servoy project (like a Java based Filemaker)
> - about 2 years full-time PHP (including one MVC project with
> CodeIgniter)
>
> I tried picking up the "Agile Web Development with Rails" book a
> couple years ago (without studying Ruby).  I went through the demo app
> well enough, but hobbled along with a first pet-project that left me
> scratching my head a bit.  Maybe I just didn't put enough time into
> it, or maybe it was like what TiNo (above) was saying - had problems
> distinguishing between Ruby classes/conventions and the Rails ones,
> which just added to my brain load and slowed me down when looking at a
> page of Ruby/Rails code.
>
> I spoke with the instructor of the Python and Django courses, and he
> said I should take the Python and learn Django online, if I had to
> choose (especially since my project may require deviation from the
> Django ORM into SQLAlchemy, etc.).  My only reservation being that I
> want to start using Django fast to actually build stuff.  And, it
> sounds like you guys are saying that taking the Django course should
> be okay since I have previous programming experience in other
> languages (just brush up and take a book).
>
> Normally I wouldn't even bother with programming bootcamps like this -
> but we have an education budget available, and I imagine having a
> Python or Django expert by my side for 5 days could be quite helpful
> at times.
>
> So, still not sure what I should do, but thanks for the tips.
>
> On Aug 14, 3:11 am, Alexandru-Emil Lupu  wrote:
>
> > HI!
> > personally i have started using Python / Django around 2 weeks ago. I do not
> > know very much of it, but on a long term, my situation looks like:
> > 3 years pascal Programming
> > 5 years php Programming (1 with symfony framework)
> > 2 weeks of Python / Django
>
> > I cannot say that i have read any material, but i have had a look into the
> > django book (if you have some programming MVC experience, you will find the
> > tutorial straight forward). and every time i have a question or so, i check
> > the book. I know .. is not recomended to do so, but you will be able to
> > start your project, and make a small progress, and start learning Django, by
> > doing it.
>
> > Alecs
>
> > On Fri, Aug 14, 2009 at 12:30 PM, Emily Rodgers <
>
> > emily.kate.rodg...@googlemail.com> wrote:
>
> > > On Aug 14, 9:42 am, Wayne Koorts  wrote:
> > > > > I currently know zero Python and want to start a project with Django
> > > > > ASAP.  I've got the opportunity through my work to either take a 5-day
> > > > > Python bootcamp or a Django bootcamp - not both.
>
> > > > I don't really think this is a useful question on its own.  A more
> > > > appropriate question would be "How much programming experience do I
> > > > need?".  If you have prior programming experience in another language
> > > > then I'm sure you'll find Python quick and easy to pick up.  In that
> > > > case going through the tutorial and playing around with it in an
> > > > afternoon should be enough to prep you for a Django book or course.
>
> > > > If you have no programming experience at all then out of the two
> > > > options it would be better to take the Python one.  Any pure Django
> > > > course would assume a certain amount of Python knowledge.  But even if
> > > > you take a Python course you need to know if the particular course
> > > > assumes prior programming experience of some kind of is more of an
> > > > "Introduction to Programming Using Python".  If you take a Django
> > > > course with no programming experience at all then you will be wasting
> > > > your time.  If you have experience in some kind of programming and
> > > > then take a Django course with no Python experience then you might be
> > > > able to get by.
>
> > > > Regards,
> > > > Wayne
>
> > > I would second this. but also if you do the django course, take a
> > > python book with you - then if you don't get something you can just
> > > look it up in the book quickly (the python website would also do, it
> > > just depends on whether you prefer to learn from books or the web).
> > > Remember, the people teaching the django course will know python, so
> > > will be able to give you a bit of guidance if you get really stuck,
> > > but if you go on the python course, it won't necessarily help get you
> > > up and running with django. The poll tutorial on the 

Re: how much python do i need to know to learn/use Django?

2009-08-14 Thread snfctech

Thanks for all the helpful replies, django-users group!

I've got:

- Java and C++ coursework
- a little professional Java, Perl and Tcl/Tk experience (off and on
over several years)
- 1 year large Servoy project (like a Java based Filemaker)
- about 2 years full-time PHP (including one MVC project with
CodeIgniter)

I tried picking up the "Agile Web Development with Rails" book a
couple years ago (without studying Ruby).  I went through the demo app
well enough, but hobbled along with a first pet-project that left me
scratching my head a bit.  Maybe I just didn't put enough time into
it, or maybe it was like what TiNo (above) was saying - had problems
distinguishing between Ruby classes/conventions and the Rails ones,
which just added to my brain load and slowed me down when looking at a
page of Ruby/Rails code.

I spoke with the instructor of the Python and Django courses, and he
said I should take the Python and learn Django online, if I had to
choose (especially since my project may require deviation from the
Django ORM into SQLAlchemy, etc.).  My only reservation being that I
want to start using Django fast to actually build stuff.  And, it
sounds like you guys are saying that taking the Django course should
be okay since I have previous programming experience in other
languages (just brush up and take a book).

Normally I wouldn't even bother with programming bootcamps like this -
but we have an education budget available, and I imagine having a
Python or Django expert by my side for 5 days could be quite helpful
at times.

So, still not sure what I should do, but thanks for the tips.

On Aug 14, 3:11 am, Alexandru-Emil Lupu  wrote:
> HI!
> personally i have started using Python / Django around 2 weeks ago. I do not
> know very much of it, but on a long term, my situation looks like:
> 3 years pascal Programming
> 5 years php Programming (1 with symfony framework)
> 2 weeks of Python / Django
>
> I cannot say that i have read any material, but i have had a look into the
> django book (if you have some programming MVC experience, you will find the
> tutorial straight forward). and every time i have a question or so, i check
> the book. I know .. is not recomended to do so, but you will be able to
> start your project, and make a small progress, and start learning Django, by
> doing it.
>
> Alecs
>
> On Fri, Aug 14, 2009 at 12:30 PM, Emily Rodgers <
>
>
>
> emily.kate.rodg...@googlemail.com> wrote:
>
> > On Aug 14, 9:42 am, Wayne Koorts  wrote:
> > > > I currently know zero Python and want to start a project with Django
> > > > ASAP.  I've got the opportunity through my work to either take a 5-day
> > > > Python bootcamp or a Django bootcamp - not both.
>
> > > I don't really think this is a useful question on its own.  A more
> > > appropriate question would be "How much programming experience do I
> > > need?".  If you have prior programming experience in another language
> > > then I'm sure you'll find Python quick and easy to pick up.  In that
> > > case going through the tutorial and playing around with it in an
> > > afternoon should be enough to prep you for a Django book or course.
>
> > > If you have no programming experience at all then out of the two
> > > options it would be better to take the Python one.  Any pure Django
> > > course would assume a certain amount of Python knowledge.  But even if
> > > you take a Python course you need to know if the particular course
> > > assumes prior programming experience of some kind of is more of an
> > > "Introduction to Programming Using Python".  If you take a Django
> > > course with no programming experience at all then you will be wasting
> > > your time.  If you have experience in some kind of programming and
> > > then take a Django course with no Python experience then you might be
> > > able to get by.
>
> > > Regards,
> > > Wayne
>
> > I would second this. but also if you do the django course, take a
> > python book with you - then if you don't get something you can just
> > look it up in the book quickly (the python website would also do, it
> > just depends on whether you prefer to learn from books or the web).
> > Remember, the people teaching the django course will know python, so
> > will be able to give you a bit of guidance if you get really stuck,
> > but if you go on the python course, it won't necessarily help get you
> > up and running with django. The poll tutorial on the django website is
> > brilliant for showing the different features and getting you started
> > though.
>
> > If you have no programming experience and don't know python, the
> > django course will be a lot to take in at once.
>
> > Em
>
> --
> As programmers create bigger & better idiot proof programs, so the universe
> creates bigger & better idiots!
> I am on web:  http://www.alecslupu.ro/
> I am on twitter:http://twitter.com/alecslupu
> I am on linkedIn:http://www.linkedin.com/in/alecslupu
> Tel: (+4)0748.543.798

Re: Override __init__()

2009-08-14 Thread Daniel Roseman

On Aug 14, 3:50 pm, Léon Dignòn  wrote:
> Hi Emily,
>
> thanks so far!
>
> unfortunately this line:
>
> > instance = getattr(kwargs, 'instance')
> throws this error:
> > Exception Value: 'dict' object has no attribute 'instance'
>
> what next?
>

That should be:

instance = kwargs.get('instance')
--
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: Override __init__()

2009-08-14 Thread Léon Dignòn

Hi Emily,

thanks so far!

unfortunately this line:
> instance = getattr(kwargs, 'instance')
throws this error:
> Exception Value: 'dict' object has no attribute 'instance'

what next?

On Aug 14, 1:52 pm, Emily Rodgers 
wrote:
> On Aug 14, 12:14 pm, Léon Dignòn  wrote:
>
>
>
>
>
> > Hi,
>
> > I try override a ModelForms init to claim the variable instance. After
> > that I call super.__init__().
> > It's almost working, but there is no form shown in the browser.  Any
> > ideas what might be wrong?
>
> > class ProfileForm(ModelForm):
> >     first_name = forms.CharField(required=False, max_length=30)
> >     last_name = forms.CharField(required=False, max_length=30)
>
> >     class Meta:
> >         model = UserProfile
> >         exclude = ('user',) # User will be filled in by the view.
>
> >     def __init__(self, data=None, files=None, auto_id='id_%s',
> > prefix=None, initial=None,
> >                  error_class=None, label_suffix=':',
> > empty_permitted=False, instance=None):
> >         f = open('debug.txt', 'w')
> >         f.write("%s \n\n-\n\n" % instance.user.first_name) # Bob
> >         f.write("%s \n\n-\n\n" % instance.user.last_name) # Marley
> >         super(ProfileForm, self).__init__(data, files, auto_id,
> > prefix, initial, error_class, label_suffix, empty_permitted, instance)
>
> Rather than listing all the key word arguments (kwargs) like that, you
> are better doing it like this:
>
> import logging # probably a better way than writing to debug.txt, but
> clearly it is personal choice
>
> def __init__(self, *args, **kwargs):
>     instance = getattr(kwargs, 'instance')
>     logging.debug("First name: %s" % instance.user.first_name) # I
> like to know what it thinks it is printing!
>     logging.debug("Last name: %s" % instance.user.last_name) #
> obviously you can change str if you like
>     super(ProfileForm, self).__init__(data, *args, **kwargs)
>
> I don't know if this will fix your problem (hard to say without
> visibility of the view), but it may be that you have forgotten one of
> the kwargs. If you want to add extra parameters, or set them to
> specific values you can still do this before calling init.
>
> HTH,
> Em- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: Theory: Models/Apps

2009-08-14 Thread Peter Herndon

On 08/14/2009 12:36 AM, Vadivel Kumar wrote:
> I have recently started on Django .. going awesome .. I know, this 
> question might have popped out several times before, but since Google 
> does not yield me any results, I am writing this post. However, do 
> point out resources if any in this mailing list.
>
> 1. What is the fundamental difference of APP versus PROJECT in Django 
> terminology. For instance, is it right to say, POSTS is an APP and 
> BLOG is a PROJECT or ORDERS is an APP and ORDER_MANAGEMENT is a PROJECT ..

One way to describe a "project" is "web site", or "web application".  
You have a top-level urls.py, a top-level settings.py, and in your 
settings you are specifying which "apps" are to be used in this site.  
An app, then, does NOT need to sit in the project directory.  Instead, 
it can and should be a Python package and should be made available to 
your "project" via being on the PYTHONPATH.  That way, the app is 
available to any other projects at the same time.

For more on this structure, read James Bennett's _Practical Django 
Projects_, and his blog entries on the subject.

> 2. Particularly, I don't like the idea of using a single models.py for 
> many entities, I would rather to keep separate files for each of 
> entity .. in a scenario like a huge team is working on a project, this 
> approach will create unnecessary noise. Any answers?

As others have stated, feel free to break out models.py into 
../models/__init__.py and ../models/, ../models/, 
etc.  However, one major point to keep in mind is that if you restrict a 
given "app" to providing a single function (or small set of intimately 
related functions), and break other functionality into other apps, then 
the models.py for a given app will generally never get too terribly 
big.  This separation and modularization is part of the success factor 
for Django -- there are hundreds, perhaps thousands of reusable apps you 
can plug in to provide functionality for your site.  And when you start 
thinking that your models.py, or views.py, is getting too big, you 
should probably start asking yourself if you split a related set of 
functionality out into its own app.

---Peter Herndon

--~--~-~--~~~---~--~~
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: Using Psycopg2 on Windows

2009-08-14 Thread James Walmsley

Just in case anyone happens to be still wrestling with this problem. 
There was something wrong with the latest build of Psycopg2, which 
stopped it all working.

Simply install an earlier version, (2.0.10 works great), even with 
PostgreSQL 8.4.x series.

James

James Walmsley wrote:
> Hi,
>
> I'm trying to get started with Django, and everything was going
> wonderfully until I tried to use models (and I had to set up
> postgreSQL).
>
> I've installed psycopg2 from the provided compiled binaries, but when
> I run:
>
> manage.py runserver
>
> I get the following errors:
>
> Error loading psycopg2 module: DLL load failed: The applicatio has
> failed to start because its side-by-side configuration is incorrect.
> Please see the application event log for more detail.
>
> The application event log in Vista says:
>
> Activation context generation failed for "C:\Python26\lib\site-packages
> \psycopg2\_psycopg.pyd". Dependent Assembly
> Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053"
> could not be found. Please use sxstrace.exe for detailed diagnosis.
>
> Any help would be appreciated, I also tried to build psycopg2 from
> source, build I still get a DLL load fail.
>
> James
>
>
>
> >
>   


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



Portal Apps

2009-08-14 Thread Joshua Williams

Quick question in regards to building portable apps:  Should an  
application rely on the app being on the PYTHONPATH to work properly?   
That is, is having a app directory on the PYTHONPATH so common, is  
should just be assumed this is done when you install a new app?

-Josh

--~--~-~--~~~---~--~~
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: showing templates error to user

2009-08-14 Thread Michael
On Fri, Aug 14, 2009 at 9:08 AM, Marcos Daniel Petry
wrote:

> I don't know if you can do this, but someone will know ...
>
> I have an app that works similar to a flatpage, the user registers a
> content and an url address in the database, and this record is displayed on
> a page, allowing the addition of User post html tags, certain Django
> filters. The problem is when the user misses one of these filters, I would
> like to implement a kind of validation, showing where the error is,
> something similar to the debug Django, showing where the line is, not an
> "Internal Server Error"
>

Would form validation work?
http://docs.djangoproject.com/en/dev/ref/forms/validation/

You can check the form and then return the form with errors, so everything
is validated.

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



showing templates error to user

2009-08-14 Thread Marcos Daniel Petry
I don't know if you can do this, but someone will know ...

I have an app that works similar to a flatpage, the user registers a content
and an url address in the database, and this record is displayed on a page,
allowing the addition of User post html tags, certain Django filters. The
problem is when the user misses one of these filters, I would like to
implement a kind of validation, showing where the error is, something
similar to the debug Django, showing where the line is, not an "Internal
Server Error"


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



problems with reverse lookup of cache_page view

2009-08-14 Thread Robert

I am having a problem with cache_page and url resolver, my problem is
that django doesn't resolve correctly my url to the correct url when
the view is cached with cache_page decorator.

In fact this is in the context of sitemaps contrib, what I am doing is
the following:

(r'^sitemap.xml$', index, {'sitemaps': sitemaps}),
(r'^sitemap-(?P.+)\.xml$', cache_page(sitemap, 24 * 60 *
60), {'sitemaps': sitemaps}),

then I get the following response in sitemap.xml:



http://localhost:8000/barcelona/sitemap.xml


http://localhost:8000/barcelona/sitemap.xml

...


Which is incorrect because should have the diferent url for each
section sitemap-.xml. I think this is related to an issue
closed for python 2.4 but I am experiementing this problem also with
python 2.5.2, anyone else has this problem ? my django version is the
revisio 9080
--~--~-~--~~~---~--~~
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: Problem with getting setting up apache server for django

2009-08-14 Thread NiJoMi

Installed Python 2.6.2 for all users and apache server failed to
configure mod_wsgi, so I installed
mod_wsgi-win32-ap22py26-3.0c4.so and renamed it mod_wsgi.so and apache
configured the mod.

however I am still getting 500 Internal Server Error

testproject.lc-error.log

[Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1] mod_wsgi
(pid=360): Exception occurred processing WSGI script 'E:/Django/
testproject/apache/django.wsgi'.
[Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1] Traceback (most
recent call last):
[Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line
230, in __call__
[Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]
self.load_middleware()
[Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\site-packages\\django\\core\\handlers\\base.py", line
33, in load_middleware
[Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1] for
middleware_path in settings.MIDDLEWARE_CLASSES:
[Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\site-packages\\django\\utils\\functional.py", line
269, in __getattr__
[Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1] self._setup
()
[Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\site-packages\\django\\conf\\__init__.py", line 40, in
_setup
[Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]
self._wrapped = Settings(settings_module)
[Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\site-packages\\django\\conf\\__init__.py", line 75, in
__init__
[Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1] raise
ImportError, "Could not import settings '%s' (Is it on sys.path? Does
it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
[Fri Aug 14 13:07:42 2009] [error] [client 127.0.0.1] ImportError:
Could not import settings 'testproject.settings' (Is it on sys.path?
Does it have syntax errors?): No module named testproject.settings

I have added
;C:\Python26;C:\Python26\Tools\Scripts
to the end of  path in system variables
and created the system variable PYTHONHOME  value=C:\Python26\Lib\site-
packages\django

django.wsgi

import os
import sys

sys.path.append('/usr/local/django')
sys.path.append('/usr/local/django/testproject')

os.environ['DJANGO_SETTINGS_MODULE'] = 'testproject.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

I have tried
sys.path.append('/E:/Django')
sys.path.append('/E:/Django/testproject')

and
sys.path.append('E:/Django')
sys.path.append('E:/Django/testproject')

but I still get the error, something tells me I hav'nt grasped paths.
---
testproject location:
E:/Django/testproject
---
django location
C:\Python26\Lib\site-packages\django
---
when I have this working I will post a tutorial for Python/Django
dummies like myself.
I can't thank you enough for all your help.

On 14 Aug, 08:58, Graham Dumpleton  wrote:
> Reinstall Python with latest Python 2.6 version and this time select
> option that says 'install for all users' and not the option 'install
> only for current user'. That should fix the problem.
>
> Graham
>
> On Aug 14, 5:22 pm, NiJoMi  wrote:
>
> > Thank you Graham that has cured the access problem but I now get 500
> > Internal Server Error,
>
> > testproject.lc-error.log
>
> > [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1] mod_wsgi
> > (pid=2076): Target WSGI script 'E:/Django/testproject/apache/
> > django.wsgi' cannot be loaded as Python module.
> > [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1] mod_wsgi
> > (pid=2076): Exception occurred processing WSGI script 'E:/Django/
> > testproject/apache/django.wsgi'.
> > [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1] Traceback (most
> > recent call last):
> > [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]   File "E:/
> > Django/testproject/apache/django.wsgi", line 5, in 
> > [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]     import
> > django.core.handlers.wsgi
> > [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line
> > 8, in 
> > [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]     from django
> > import http
> > [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]   File "C:\
> > \Python26\\lib\\site-packages\\django\\http\\__init__.py", line 5, in
> > 
> > [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]     from urllib
> > import urlencode
> > [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]   File 

Re: Using glovar vars

2009-08-14 Thread Jani Tiainen

Steve Patrick kirjoitti:
> Hi everybody,
> I´m new in Django and maybe my problem is a bit stupid...I would like
> to use a global variable (for all the application) to store some info

No you don't want to. And even it's possible in theory, you shouldn't 
even consider that option.

> that I get in my firts page. I know I can send variables using
> render_to_response, but is there any other easy way??is it possible to
> define a global variable, initialize it in my first page and just use
> it??

Store value in session?

First at all, your variable would only live time of request (meaning 
from the moment URL is parsed and reponse is sent to your browser). What 
  happens to your "global" after that? It wouldn't exist on next request.

-- 
Jani Tiainen

--~--~-~--~~~---~--~~
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: Override __init__()

2009-08-14 Thread Emily Rodgers



On Aug 14, 12:14 pm, Léon Dignòn  wrote:
> Hi,
>
> I try override a ModelForms init to claim the variable instance. After
> that I call super.__init__().
> It's almost working, but there is no form shown in the browser.  Any
> ideas what might be wrong?
>
> class ProfileForm(ModelForm):
>     first_name = forms.CharField(required=False, max_length=30)
>     last_name = forms.CharField(required=False, max_length=30)
>
>     class Meta:
>         model = UserProfile
>         exclude = ('user',) # User will be filled in by the view.
>
>     def __init__(self, data=None, files=None, auto_id='id_%s',
> prefix=None, initial=None,
>                  error_class=None, label_suffix=':',
> empty_permitted=False, instance=None):
>         f = open('debug.txt', 'w')
>         f.write("%s \n\n-\n\n" % instance.user.first_name) # Bob
>         f.write("%s \n\n-\n\n" % instance.user.last_name) # Marley
>         super(ProfileForm, self).__init__(data, files, auto_id,
> prefix, initial, error_class, label_suffix, empty_permitted, instance)

Rather than listing all the key word arguments (kwargs) like that, you
are better doing it like this:

import logging # probably a better way than writing to debug.txt, but
clearly it is personal choice

def __init__(self, *args, **kwargs):
instance = getattr(kwargs, 'instance')
logging.debug("First name: %s" % instance.user.first_name) # I
like to know what it thinks it is printing!
logging.debug("Last name: %s" % instance.user.last_name) #
obviously you can change str if you like
super(ProfileForm, self).__init__(data, *args, **kwargs)

I don't know if this will fix your problem (hard to say without
visibility of the view), but it may be that you have forgotten one of
the kwargs. If you want to add extra parameters, or set them to
specific values you can still do this before calling init.

HTH,
Em

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



FilePathField refresh

2009-08-14 Thread captainmish

Hello
Im trying to implement an "alternative upload" method for getting big
files into my django app - and was hoping to allow users to scp/rsync
etc files to the server, then use FilePathField to browse them and use
them to make objects with FileField.
The files are all shown in the path specified and work fine, but the
problem comes in seeing new files - the server needs to be reloaded
before any new files are shown in the filepathfield select...
Is there a workaround for this, or an alternative way of doing it?
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
-~--~~~~--~~--~--~---



Using glovar vars

2009-08-14 Thread Steve Patrick

Hi everybody,
I´m new in Django and maybe my problem is a bit stupid...I would like
to use a global variable (for all the application) to store some info
that I get in my firts page. I know I can send variables using
render_to_response, but is there any other easy way??is it possible to
define a global variable, initialize it in my first page and just use
it??
Thanks for your 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
-~--~~~~--~~--~--~---



Override __init__()

2009-08-14 Thread Léon Dignòn

Hi,

I try override a ModelForms init to claim the variable instance. After
that I call super.__init__().
It's almost working, but there is no form shown in the browser.  Any
ideas what might be wrong?

class ProfileForm(ModelForm):
first_name = forms.CharField(required=False, max_length=30)
last_name = forms.CharField(required=False, max_length=30)

class Meta:
model = UserProfile
exclude = ('user',) # User will be filled in by the view.

def __init__(self, data=None, files=None, auto_id='id_%s',
prefix=None, initial=None,
 error_class=None, label_suffix=':',
empty_permitted=False, instance=None):
f = open('debug.txt', 'w')
f.write("%s \n\n-\n\n" % instance.user.first_name) # Bob
f.write("%s \n\n-\n\n" % instance.user.last_name) # Marley
super(ProfileForm, self).__init__(data, files, auto_id,
prefix, initial, error_class, label_suffix, empty_permitted, instance)
--~--~-~--~~~---~--~~
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: Theory: Models/Apps

2009-08-14 Thread Vadivel Kumar
Thanks Guys ...

On Fri, Aug 14, 2009 at 1:45 PM, TiNo  wrote:

>
>
> On Fri, Aug 14, 2009 at 09:12, Jani Tiainen  wrote:
>
>>
>> Vadivel Kumar kirjoitti:
>> > I have recently started on Django .. going awesome .. I know, this
>> > question might have popped out several times before, but since Google
>> > does not yield me any results, I am writing this post. However, do point
>> > out resources if any in this mailing list.
>> >
>> > 1. What is the fundamental difference of APP versus PROJECT in Django
>> > terminology. For instance, is it right to say, POSTS is an APP and BLOG
>> > is a PROJECT or ORDERS is an APP and ORDER_MANAGEMENT is a PROJECT ..
>> >
>> > 2. Particularly, I don't like the idea of using a single models.py for
>> > many entities, I would rather to keep separate files for each of entity
>> > .. in a scenario like a huge team is working on a project, this approach
>> > will create unnecessary noise. Any answers?
>>
>
> Also keep in mind that models are just Python classes. So to split up your
> models in different files, you just set up a directory like this:
>
> project
> | - app
>   | - models (dir)
> | - __init__.py
> | - post.py
> | - comment.py
>   | - urls.py
>   | - ...
> | - anotherapp..
>
> Then you can import your models as: from app.models.post import Post
> or you can import them in you __init__ file and import them as normal
> # __init__.py
> from post import Post
> from comment import Comment
>
> # somewhere else:
> from app.models import Post, Comment
>
> Or use a decent versioning system...
>
> Tino
>
>>
>>
>> http://docs.djangoproject.com/en/dev/intro/tutorial01/#id3
>>
>> There is answers to both your questions.
>
>
>> --
>> Jani Tiainen
>>
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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 much python do i need to know to learn/use Django?

2009-08-14 Thread Alexandru-Emil Lupu
HI!
personally i have started using Python / Django around 2 weeks ago. I do not
know very much of it, but on a long term, my situation looks like:
3 years pascal Programming
5 years php Programming (1 with symfony framework)
2 weeks of Python / Django

I cannot say that i have read any material, but i have had a look into the
django book (if you have some programming MVC experience, you will find the
tutorial straight forward). and every time i have a question or so, i check
the book. I know .. is not recomended to do so, but you will be able to
start your project, and make a small progress, and start learning Django, by
doing it.

Alecs

On Fri, Aug 14, 2009 at 12:30 PM, Emily Rodgers <
emily.kate.rodg...@googlemail.com> wrote:

>
>
>
> On Aug 14, 9:42 am, Wayne Koorts  wrote:
> > > I currently know zero Python and want to start a project with Django
> > > ASAP.  I've got the opportunity through my work to either take a 5-day
> > > Python bootcamp or a Django bootcamp - not both.
> >
> > I don't really think this is a useful question on its own.  A more
> > appropriate question would be "How much programming experience do I
> > need?".  If you have prior programming experience in another language
> > then I'm sure you'll find Python quick and easy to pick up.  In that
> > case going through the tutorial and playing around with it in an
> > afternoon should be enough to prep you for a Django book or course.
> >
> > If you have no programming experience at all then out of the two
> > options it would be better to take the Python one.  Any pure Django
> > course would assume a certain amount of Python knowledge.  But even if
> > you take a Python course you need to know if the particular course
> > assumes prior programming experience of some kind of is more of an
> > "Introduction to Programming Using Python".  If you take a Django
> > course with no programming experience at all then you will be wasting
> > your time.  If you have experience in some kind of programming and
> > then take a Django course with no Python experience then you might be
> > able to get by.
> >
> > Regards,
> > Wayne
>
> I would second this. but also if you do the django course, take a
> python book with you - then if you don't get something you can just
> look it up in the book quickly (the python website would also do, it
> just depends on whether you prefer to learn from books or the web).
> Remember, the people teaching the django course will know python, so
> will be able to give you a bit of guidance if you get really stuck,
> but if you go on the python course, it won't necessarily help get you
> up and running with django. The poll tutorial on the django website is
> brilliant for showing the different features and getting you started
> though.
>
> If you have no programming experience and don't know python, the
> django course will be a lot to take in at once.
>
> Em
> >
>


-- 
As programmers create bigger & better idiot proof programs, so the universe
creates bigger & better idiots!
I am on web:  http://www.alecslupu.ro/
I am on twitter: http://twitter.com/alecslupu
I am on linkedIn: http://www.linkedin.com/in/alecslupu
Tel: (+4)0748.543.798

--~--~-~--~~~---~--~~
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 much python do i need to know to learn/use Django?

2009-08-14 Thread Emily Rodgers



On Aug 14, 9:42 am, Wayne Koorts  wrote:
> > I currently know zero Python and want to start a project with Django
> > ASAP.  I've got the opportunity through my work to either take a 5-day
> > Python bootcamp or a Django bootcamp - not both.
>
> I don't really think this is a useful question on its own.  A more
> appropriate question would be "How much programming experience do I
> need?".  If you have prior programming experience in another language
> then I'm sure you'll find Python quick and easy to pick up.  In that
> case going through the tutorial and playing around with it in an
> afternoon should be enough to prep you for a Django book or course.
>
> If you have no programming experience at all then out of the two
> options it would be better to take the Python one.  Any pure Django
> course would assume a certain amount of Python knowledge.  But even if
> you take a Python course you need to know if the particular course
> assumes prior programming experience of some kind of is more of an
> "Introduction to Programming Using Python".  If you take a Django
> course with no programming experience at all then you will be wasting
> your time.  If you have experience in some kind of programming and
> then take a Django course with no Python experience then you might be
> able to get by.
>
> Regards,
> Wayne

I would second this. but also if you do the django course, take a
python book with you - then if you don't get something you can just
look it up in the book quickly (the python website would also do, it
just depends on whether you prefer to learn from books or the web).
Remember, the people teaching the django course will know python, so
will be able to give you a bit of guidance if you get really stuck,
but if you go on the python course, it won't necessarily help get you
up and running with django. The poll tutorial on the django website is
brilliant for showing the different features and getting you started
though.

If you have no programming experience and don't know python, the
django course will be a lot to take in at once.

Em
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



admin running in dev mode (manage.py runserver) ignores MEDIA_URL

2009-08-14 Thread Aljosa Mohorovic

settings.py:
MEDIA_ROOT = "%s/media" % PROJECT_ROOT # set to media folder in
project root
MEDIA_URL = '/media/'
ADMIN_MEDIA_PREFIX = '/media/admin/'

urls.py
if settings.DEBUG:
  urlpatterns += patterns('',
(r'^media/(?P.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes':True}),
  )

example:
PROJECT_ROOT/media/admin/img/admin/default-bg.gif exists but
PROJECT_ROOT/env/lib/python2.6/site-packages/django/contrib/admin/
media/img/admin/default-bg.gif is used instead.

when i use mod_wsgi to run this instead of manage.py runserver it
works as expected.

anybody knows how to force django admin when running in dev mode
(manage.py runserver) to use images from MEDIA_URL and not images in
django/contrib/admin/media?

Aljosa Mohorovic
--~--~-~--~~~---~--~~
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: Spellchecker gives error when clicked with empty textarea.

2009-08-14 Thread Joost Cassee

On Aug 13, 12:59 pm, Sonal Breed  wrote:

> I installed Pyenchant package and have spellchecker in the tinymce
> toolbar. The spellchecker button works fine when there is some text in
> associated text area. However, when I click the button with empty text
> area, following error is displayed in a dialog box:
>
> Error response: Error running spellchecker
>   Request
>
> Does anybody know the solution to this??

It looks like the first part of an error response, filtered through
the django-logging middleware. Are you using django-logging?

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



ANN: Grappelli 2.0 prerelease

2009-08-14 Thread patrickk

The prerelease of Grappelli 2 is out now.

–Screenshots
http://code.google.com/p/django-grappelli/wiki/screenshots

–Source
The Source is currently available in /branches/grappelli_2/. Please
read the Documentation for Installtion & Setup:
http://code.google.com/p/django-grappelli/wiki/Grappelli_2

–Note
Please be aware that the behaviour might slightly change within the
next couple of days. Most of the stuff should be done, but we only
have a couple of different setups for testing (therefore, not every
usecase might be covered right now).

Testing/Feedback is very much appreciated.

Thanks,
Patrick
--~--~-~--~~~---~--~~
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 much python do i need to know to learn/use Django?

2009-08-14 Thread Wayne Koorts

> I currently know zero Python and want to start a project with Django
> ASAP.  I've got the opportunity through my work to either take a 5-day
> Python bootcamp or a Django bootcamp - not both.

I don't really think this is a useful question on its own.  A more
appropriate question would be "How much programming experience do I
need?".  If you have prior programming experience in another language
then I'm sure you'll find Python quick and easy to pick up.  In that
case going through the tutorial and playing around with it in an
afternoon should be enough to prep you for a Django book or course.

If you have no programming experience at all then out of the two
options it would be better to take the Python one.  Any pure Django
course would assume a certain amount of Python knowledge.  But even if
you take a Python course you need to know if the particular course
assumes prior programming experience of some kind of is more of an
"Introduction to Programming Using Python".  If you take a Django
course with no programming experience at all then you will be wasting
your time.  If you have experience in some kind of programming and
then take a Django course with no Python experience then you might be
able to get by.

Regards,
Wayne

--~--~-~--~~~---~--~~
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 much python do i need to know to learn/use Django?

2009-08-14 Thread TiNo
On Fri, Aug 14, 2009 at 03:08, snfctech  wrote:

> I don't anticipate having a whole bunch of time to brush up on Python
> before the Django class - but is that necessary?  How much Python do I
> need to know before learning/using Django?  Would a little brush up on
> Python + intensive Django be okay?  Or should I use my resources for
> intensive Python and then use online tutorials/ books for Django?
>

I would make sure you know a little Python, especially about classes,
classmethods and inheritance. Otherwise you might have a hard time making
distinction between Django functions and methods and built-in Python stuff.
But it shouldn't be to hard to learn both at the same time.

Tino

--~--~-~--~~~---~--~~
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 much python do i need to know to learn/use Django?

2009-08-14 Thread djangonoob

hey, just some personal tips from my personal learning journey.

I started off by learning the basics and syntax of python ( such as
how the functions look like,
the for loop, ifs else etc cos it is slightly different ). I read teh
book : Dive into python which is available free online.
I only read teh first 4 chapters. (i have some C programming
experience )

Afterwhich i went straight into the online djangobook ( the first 7 or
8 chapters to understand
how it works ).

It took me about 2 weeks ( i spent about 2 or 3 hours per day ) to
learn what is going on,
and by than i could already write some decent projects already using
Django.

The good thing by not going to the book camp is that u control your
pace.

Yup hope this helps.

On Aug 14, 9:08 am, snfctech  wrote:
> I currently know zero Python and want to start a project with Django
> ASAP.  I've got the opportunity through my work to either take a 5-day
> Python bootcamp or a Django bootcamp - not both.
>
> I don't anticipate having a whole bunch of time to brush up on Python
> before the Django class - but is that necessary?  How much Python do I
> need to know before learning/using Django?  Would a little brush up on
> Python + intensive Django be okay?  Or should I use my resources for
> intensive Python and then use online tutorials/ books for Django?
>
> Also important to note:  The project I want to start may involve using
> SQLAlchemy and/or Elixir if the Django ORM doesn't support multiple
> database connections in time.
>
> Thanks for the tips.
--~--~-~--~~~---~--~~
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: admin problems with the docu

2009-08-14 Thread quant

hi

so i read and tryed all your idears here, but nothing of these is
working... i'am running Django version 1.0.2 final

and my settings.py is looking like this:

http://dpaste.com/80427

and my urls.py ist this:

http://dpaste.com/80430

hope anyone see the problem going on here

ans thanks to all who help me

On Aug 13, 4:22 pm, Karen Tracey  wrote:
> On Thu, Aug 13, 2009 at 9:49 AM, Alexandru-Emil Lupu
> wrote:
>
> > HI!
> > the doc is updated for the 1.1 version ..
> > try this
>
> > urlpatterns = patterns('',
> >    (r'^admin/',admin.site.root),
> > )
>
> > see more here:http://code.djangoproject.com/ticket/10050
>
> Indeed, since the Django version shown on the debug page is 1.0.2 this is
> the correct url pattern for admin.  However there's something else going
> wrong here also.
>
>
>
> > On Thu, Aug 13, 2009 at 3:52 PM, quant <
> > spielm...@th.physik.uni-frankfurt.de> wrote:
>
> >> hi
>
> >> i am pretty new to django and i started to check the docu out to see
> >> how it works and i had a problem to get the admin interface working...
>
> >> i followed all the steps from the doco and if i set the options in the
> >> urls.py on i got many errors ans nothing work anymore
>
> >> i set the following in the urls.py:
>
> >> from django.conf.urls.defaults import *
>
> >> from django.contrib import admin
> >> admin.autodiscover()
>
> >> urlpatterns = patterns('',
> >>    (r'^admin/', include(admin.site.urls)),
> >> )
>
> What are you trying to get to work here: the basic admin or the admin
> documentation?  The url pattern you show is for admin, not the admin docs.
> As mentioned above, it is also the wrong pattern for the version of Django
> you are running.  But based on the debug info posted, this url pattern
> doesn't appear to be what is being used.  If that pattern were used with
> Django 1.0.2, you would get an AttributeError: 'AdminSite' object has no
> attribute 'urls'.  Instead what is on the dpaste page is a
> TemplateDoesNotExist for admin_doc/missing_docutils.html.  The only way I
> can recreate that is if I take the admindoc url pattern:
>
>     (r'^admin/doc/', include('django.contrib.admindocs.urls')),
>
> and remove the trailing doc/ part.  Did you do that?
>
>
>
> >> and i got the following error, if i tryed to start the
> >>http://127.0.0.1:8000/admin/
> >> page
>
> >>http://dpaste.com/79236/
>
> The TemplateDoesNotExist error is because you have not included
> 'django.contrib.admindocs' in your INSTALLED_APPS in settings.py.  But the
> fact that the url /admin/ is being routed to an admin docs view would seem
> to indicate you've got something misconfigured in your urlpatterns also, as
> noted above.  What you should have in your urlpatterns, if you want to use
> admindocs and admin on Django 1.0.2, is:
>
>     (r'^admin/doc/', include('django.contrib.admindocs.urls')),
>     (r'^admin/(.*)', admin.site.root),
>
> Then when you go to /admin/ you will get the main admin page.  In the upper
> right there will be a "Documentation" link, and when you click there (after
> putting django.contrib.admindocs in your INSTALLED_APPS) you will likely
> (based on the template that admindocs is trying to render) get a message
> that you need to install Python's docutils library before you can use Django
> admin docs.
>
> 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: Theory: Models/Apps

2009-08-14 Thread TiNo
On Fri, Aug 14, 2009 at 09:12, Jani Tiainen  wrote:

>
> Vadivel Kumar kirjoitti:
> > I have recently started on Django .. going awesome .. I know, this
> > question might have popped out several times before, but since Google
> > does not yield me any results, I am writing this post. However, do point
> > out resources if any in this mailing list.
> >
> > 1. What is the fundamental difference of APP versus PROJECT in Django
> > terminology. For instance, is it right to say, POSTS is an APP and BLOG
> > is a PROJECT or ORDERS is an APP and ORDER_MANAGEMENT is a PROJECT ..
> >
> > 2. Particularly, I don't like the idea of using a single models.py for
> > many entities, I would rather to keep separate files for each of entity
> > .. in a scenario like a huge team is working on a project, this approach
> > will create unnecessary noise. Any answers?
>

Also keep in mind that models are just Python classes. So to split up your
models in different files, you just set up a directory like this:

project
| - app
  | - models (dir)
| - __init__.py
| - post.py
| - comment.py
  | - urls.py
  | - ...
| - anotherapp..

Then you can import your models as: from app.models.post import Post
or you can import them in you __init__ file and import them as normal
# __init__.py
from post import Post
from comment import Comment

# somewhere else:
from app.models import Post, Comment

Or use a decent versioning system...

Tino

>
>
> http://docs.djangoproject.com/en/dev/intro/tutorial01/#id3
>
> There is answers to both your questions.


> --
> Jani Tiainen
>
> >
>

--~--~-~--~~~---~--~~
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: Problem with getting setting up apache server for django

2009-08-14 Thread Graham Dumpleton

Reinstall Python with latest Python 2.6 version and this time select
option that says 'install for all users' and not the option 'install
only for current user'. That should fix the problem.

Graham

On Aug 14, 5:22 pm, NiJoMi  wrote:
> Thank you Graham that has cured the access problem but I now get 500
> Internal Server Error,
>
> testproject.lc-error.log
>
> [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1] mod_wsgi
> (pid=2076): Target WSGI script 'E:/Django/testproject/apache/
> django.wsgi' cannot be loaded as Python module.
> [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1] mod_wsgi
> (pid=2076): Exception occurred processing WSGI script 'E:/Django/
> testproject/apache/django.wsgi'.
> [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1] Traceback (most
> recent call last):
> [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]   File "E:/
> Django/testproject/apache/django.wsgi", line 5, in 
> [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]     import
> django.core.handlers.wsgi
> [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]   File "C:\
> \Python26\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line
> 8, in 
> [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]     from django
> import http
> [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]   File "C:\
> \Python26\\lib\\site-packages\\django\\http\\__init__.py", line 5, in
> 
> [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]     from urllib
> import urlencode
> [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]   File "C:\
> \Python26\\lib\\urllib.py", line 26, in 
> [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]     import
> socket
> [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]   File "C:\
> \Python26\\lib\\socket.py", line 46, in 
> [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]     import
> _socket
> [Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1] ImportError: DLL
> load failed: The specified module could not be found.
>
> Django version is SVN
>
> sorry to be a pain.
>
> On 14 Aug, 06:49, Graham Dumpleton  wrote:
>
>
>
> > On Aug 14, 3:08 pm, NiJoMi  wrote:
>
> > > Hi
> > > I am a complete novice with Django, and have run into a problem
> > > getting it to run on a wamp server.
> > > I have managed to install Python v2.6.1, WampServer2, mod_wsgi,
> > > PostgreSql, psycopg2 and Django onto WindowsXP Professional SP3 in
> > > order to make a local development server.
>
> > > I am able to create a Django test project and use it's inbuilt server
> > > to access the project, so I assume that Python and Django are
> > > correctly installed.
>
> > > The problem is when trying to serve the project from WampServer2 I get
> > > the error 403 Forbidden.
>
> > > -
> > > WampServer2 Components:
>
> > > Apache 2.2.11
> > > PHP 5.3.0
> > > MySQL 5.1.36
> > > Phpmyadmin
> > > -
> > > Install locations:
>
> > > Python
> > > C:\Python26
>
> > > Django
> > > C:\Python26\Lib\site-packages\django
>
> > > WampServer2
> > > C:\imfree
> > > --
> > > Edits to files:
>
> > > httpd.conf
>
> > > added following to top of LoadModule section:
> > > LoadModule wsgi_module modules/mod_wsgi.so
>
> > > uncommented:
> > > Include conf/extra/httpd-vhosts.conf
> > > -
> > > httpd-vhosts.conf
>
> > > commented out examples and added following:
>
> > > 
> > >     ServerAdmin webmas...@localhost
> > >     DocumentRoot "C:/imfree/www"
> > >     ServerName localhost
> > >     #ServerAliaswww.dummy-host.localhost
> > >     ErrorLog "c:/imfree/logs/localhost.log"
> > >     CustomLog "c:/imfree/logs/localhost-access.log" common
> > > 
>
> > > 
> > >    ServerAdmin webmas...@testproject
> > >    DocumentRoot "E:/Django/testproject/apache"
> > >    ServerName testproject.lc
> > >    ErrorLog "c:/imfree/logs/testproject.lc-error.log"
> > >    CustomLog "c:/imfree/logs/testproject.lc-access.log" common
>
> > > WSGIScriptAlias / /usr/local/testproject/apache/django.wsgi
>
> > > 
> > > Order allow,deny
> > > Allow from all
> > > 
>
> > If your Django site is installed in:
>
> >   E:/Django/testproject
>
> > and the WSGI script file in:
>
> >   E:/Django/testproject/apache
>
> > The above should be:
>
> >   WSGIScriptAlias / E:/Django/testproject/apache/django.wsgi
>
> >   
> >   Order allow,deny
> >   Allow from all
> >   
>
> > Graham
>
> > > ---
> > > hosts file
>
> > > added:
>
> > > 127.0.0.1       testproject.lc # django test
> > > ---
> > >  ---
> > > created file E:/Django/testproject/apache/django.wsgi
>
> > > import os, sys
> > > sys.path.append('/usr/local/django')
> > > 

Re: Problem with getting setting up apache server for django

2009-08-14 Thread NiJoMi

Thank you Graham that has cured the access problem but I now get 500
Internal Server Error,

testproject.lc-error.log

[Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1] mod_wsgi
(pid=2076): Target WSGI script 'E:/Django/testproject/apache/
django.wsgi' cannot be loaded as Python module.
[Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1] mod_wsgi
(pid=2076): Exception occurred processing WSGI script 'E:/Django/
testproject/apache/django.wsgi'.
[Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1] Traceback (most
recent call last):
[Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]   File "E:/
Django/testproject/apache/django.wsgi", line 5, in 
[Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1] import
django.core.handlers.wsgi
[Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\site-packages\\django\\core\\handlers\\wsgi.py", line
8, in 
[Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1] from django
import http
[Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\site-packages\\django\\http\\__init__.py", line 5, in

[Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1] from urllib
import urlencode
[Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\urllib.py", line 26, in 
[Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1] import
socket
[Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1]   File "C:\
\Python26\\lib\\socket.py", line 46, in 
[Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1] import
_socket
[Fri Aug 14 08:14:40 2009] [error] [client 127.0.0.1] ImportError: DLL
load failed: The specified module could not be found.

Django version is SVN

sorry to be a pain.


On 14 Aug, 06:49, Graham Dumpleton  wrote:
> On Aug 14, 3:08 pm, NiJoMi  wrote:
>
>
>
> > Hi
> > I am a complete novice with Django, and have run into a problem
> > getting it to run on a wamp server.
> > I have managed to install Python v2.6.1, WampServer2, mod_wsgi,
> > PostgreSql, psycopg2 and Django onto WindowsXP Professional SP3 in
> > order to make a local development server.
>
> > I am able to create a Django test project and use it's inbuilt server
> > to access the project, so I assume that Python and Django are
> > correctly installed.
>
> > The problem is when trying to serve the project from WampServer2 I get
> > the error 403 Forbidden.
>
> > -
> > WampServer2 Components:
>
> > Apache 2.2.11
> > PHP 5.3.0
> > MySQL 5.1.36
> > Phpmyadmin
> > -
> > Install locations:
>
> > Python
> > C:\Python26
>
> > Django
> > C:\Python26\Lib\site-packages\django
>
> > WampServer2
> > C:\imfree
> > --
> > Edits to files:
>
> > httpd.conf
>
> > added following to top of LoadModule section:
> > LoadModule wsgi_module modules/mod_wsgi.so
>
> > uncommented:
> > Include conf/extra/httpd-vhosts.conf
> > -
> > httpd-vhosts.conf
>
> > commented out examples and added following:
>
> > 
> >     ServerAdmin webmas...@localhost
> >     DocumentRoot "C:/imfree/www"
> >     ServerName localhost
> >     #ServerAliaswww.dummy-host.localhost
> >     ErrorLog "c:/imfree/logs/localhost.log"
> >     CustomLog "c:/imfree/logs/localhost-access.log" common
> > 
>
> > 
> >    ServerAdmin webmas...@testproject
> >    DocumentRoot "E:/Django/testproject/apache"
> >    ServerName testproject.lc
> >    ErrorLog "c:/imfree/logs/testproject.lc-error.log"
> >    CustomLog "c:/imfree/logs/testproject.lc-access.log" common
>
> > WSGIScriptAlias / /usr/local/testproject/apache/django.wsgi
>
> > 
> > Order allow,deny
> > Allow from all
> > 
>
> If your Django site is installed in:
>
>   E:/Django/testproject
>
> and the WSGI script file in:
>
>   E:/Django/testproject/apache
>
> The above should be:
>
>   WSGIScriptAlias / E:/Django/testproject/apache/django.wsgi
>
>   
>   Order allow,deny
>   Allow from all
>   
>
> Graham
>
> > ---
> > hosts file
>
> > added:
>
> > 127.0.0.1       testproject.lc # django test
> > --- 
> > ---
> > created file E:/Django/testproject/apache/django.wsgi
>
> > import os, sys
> > sys.path.append('/usr/local/django')
> > os.environ['DJANGO_SETTINGS_MODULE'] = 'testproject.settings'
>
> > import django.core.handlers.wsgi
>
> > application = django.core.handlers.wsgi.WSGIHandler()
> > --- 
> > --
>
> > the logs:
>
> > apache_error.log
>
> > [Fri Aug 14 05:48:35 2009] [notice] Apache/2.2.11 (Win32) PHP/5.3.0
> > mod_wsgi/2.5 Python/2.6.1 configured -- resuming normal operations
> > [Fri Aug 14 05:48:35 2009] [notice] Server built: Dec 10 2008 00:10:06
> > 

Re: Theory: Models/Apps

2009-08-14 Thread Jani Tiainen

Vadivel Kumar kirjoitti:
> I have recently started on Django .. going awesome .. I know, this 
> question might have popped out several times before, but since Google 
> does not yield me any results, I am writing this post. However, do point 
> out resources if any in this mailing list.
> 
> 1. What is the fundamental difference of APP versus PROJECT in Django 
> terminology. For instance, is it right to say, POSTS is an APP and BLOG 
> is a PROJECT or ORDERS is an APP and ORDER_MANAGEMENT is a PROJECT ..
>
> 2. Particularly, I don't like the idea of using a single models.py for 
> many entities, I would rather to keep separate files for each of entity 
> .. in a scenario like a huge team is working on a project, this approach 
> will create unnecessary noise. Any answers?

http://docs.djangoproject.com/en/dev/intro/tutorial01/#id3

There is answers to both your questions.

-- 
Jani Tiainen

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