Re: Basic Django Support

2011-05-16 Thread Jani Tiainen
Hi,

There is two common problems that may occur:

1) You don't have read and write permissions for directory where
database file resides.

2) You haven't incorrect or missing path for database file. Even Sqlite
can create database ile itself it can't create path(s) needed.

On Sun, 2011-05-15 at 09:07 -0700, David Biglin wrote:
> Hi,
> I have been playing with Python for the past year now and enjoying it.
> I am trying Django to make a web site for a friend. I am Following the
> Django Tutorial on there web site to get the basic concepts here;
> http://docs.djangoproject.com/en/dev/intro/tutorial01/
> 
> During the set up i am using SQLite3 which comes with python, how ever
> when i try and create the DB tables i get the following errors
> 
> Command to create DBTables :
> 
> python manage.py syncdb
> 
> 
> 
> The Traceback :
> 
> Traceback (most recent call last):
>   File "manage.py", line 11, in 
> execute_manager(settings)
>   File "/usr/lib/pymodules/python2.7/django/core/management/
> __init__.py", line 438, in execute_manager
> utility.execute()
>   File "/usr/lib/pymodules/python2.7/django/core/management/
> __init__.py", line 379, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/usr/lib/pymodules/python2.7/django/core/management/
> base.py", line 191, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File "/usr/lib/pymodules/python2.7/django/core/management/
> base.py", line 220, in execute
> output = self.handle(*args, **options)
>   File "/usr/lib/pymodules/python2.7/django/core/management/
> base.py", line 351, in handle
> return self.handle_noargs(**options)
>   File "/usr/lib/pymodules/python2.7/django/core/management/
> commands/syncdb.py", line 56, in handle_noargs
> cursor = connection.cursor()
>   File "/usr/lib/pymodules/python2.7/django/db/backends/
> __init__.py", line 75, in cursor
> cursor = self._cursor()
>   File "/usr/lib/pymodules/python2.7/django/db/backends/sqlite3/
> base.py", line 174, in _cursor
> self.connection = Database.connect(**kwargs)
> sqlite3.OperationalError: unable to open database file
> 
> 
> 
> 
> Any help would be amazing also any other tutorials anyone could
> recommend for starting python web development would be much
> appreciated!
> Thanks again
> 

-- 

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.



aggregation and filtering

2011-05-16 Thread Arye Lukashevski
Hi, after using aggregation
>
> x=self.results.filter(timeEnd__isnull=False).values('idTest').annotate(Max('timeEnd'))
>
> I want to filter x using .filter() over columns that are not aggregated
('result')

but instead of making it a 'having' clause
it goes into 'where'

and resulting not in expected behavior

Arye Lukashevski

-- 
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: Custom Managers and Q() Objects

2011-05-16 Thread Marc Aymerich
On Mon, May 16, 2011 at 10:21 PM, Michal Petrucha wrote:

> On Mon, May 16, 2011 at 09:58:40PM +0200, Marc Aymerich wrote:
> > Hi Swawm.
> > Thanks for your answer.
> >
> > when I call Model.objects.active_during(Q(Q(ini=some_date, end=some_date)
> |
> > Q(ini=other_date, fin=other_date))) I get This error:
> >
> >
> > active_during() takes exactly 3 arguments (2 given)
> >
> >
> >
> > this is my code:
> >
> > class OrderQuerySet(models.query.QuerySet):
> > def active_during(self, ini, end):
> > return self.filter(Q(register_date__lte = end) &
> > Q(Q(cancel_date__isnull=True) | Q(cancel_date__gte =
> ini
> > )))
> >
> > class OrderManager(models.Manager):
> > # Custom managers with chainable filters.
> > # Based on: http://djangosnippets.org/snippets/562/
> >
> > def __init__(self, qs_class=models.query.QuerySet):
> > super(OrderManager,self).__init__()
> > self.queryset_class = qs_class
> >
> > def get_query_set(self):
> > return self.queryset_class(self.model)
> >
> > def __getattr__(self, attr, *args):
> > try: return getattr(self.__class__, attr, *args)
> > except AttributeError: return getattr(self.get_query_set(), attr,
> > *args)
> >
> >
> > Seems to me that I need to define active_during() like:
> > def active_during(self, *args, **kwargs)
> >
> > and make some custom stuff if a Q() object is passed to the method. But
> what
> > I need to do?
> In this example, the active_during method is supposed to take two
> positional parameters, a start date and an end date. It then creates
> the required Q object structure required to represent a filter for
> you. What you're doing is passing it one parameter already containing
> a Q filter. That is something you'll usually want to pass to a filter,
> exclude or get method.


Hi Michal,
Yep, this is actually what I want to do, pass a Q() object to the
active_during() method. My question is, how the active_during method should
be in order to work with a Q() object passed as a parameter?

sorry if I wasn't clear in my firts mail.

-- 
Marc

-- 
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: performance of model instgance save()

2011-05-16 Thread Brian
> > I'd think you'll find it's significantly more than a factor of 2. For bulk
> > inserts, raw SQL is often several orders of magnitude faster.
>
> You might want to check outhttp://pypi.python.org/pypi/dse/. My tests
> using postgres showed a 3Xperformancegain on inserts compared to
> using the orm and nearly 10X when doing heavy updates on existing
> data. It takes care of creating SQL for you and respects default
> values defined in your models.

Common sense is telling me that any further performance gains I get
for this test script will be more than
offset by the time I've spent on them :-)

I switched to using psycopg2 directly to do the inserts (committing in
batches of several thousand) and found
roughly another factor of 2. For what it's worth, that single sample
point is in the same ballpark as the 10x improvement
mentioned for dse.

One thing that was confusing for a while was that the first batch of
inserts takes 5 times as long
as subsequent  batches. I didn't really get to the bottom of why that
might be. It might be fixed by using a server-side
cursor (maybe the first batch expands the client-side memory
inefficiently, but hangs on to it for subsequent
batches), but when I seemed to hit a bug when I tried using a named
cursor (psycopg2 2.2.1).

And then I climbed back out of the rabbit hole.

-- 
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: Set ModelMultipleChoiceField selected in clean()?

2011-05-16 Thread Nan
Sorry, I should have clarified. I have been logging.  I've logged
pretty much every variable in every method.  It's all there and
properly set until it has to be retrieved from the next form in the
wizard; and if there's an error in an unrelated field, the values do
not show as selected in the items field.

I've also tried setting self.cleaned_data['items'] instead of
returning a new dictionary from clean().  I've tried setting
self.fields['items'].initial.  No dice.

So either I'm probably doing something really dumb, but can't pin it
down, or Django just doesn't support setting the values of a
ModelMultipleChoiceField in the clean() method.



On May 16, 3:36 pm, Shawn Milochik  wrote:
> Try putting logging statements at strategic points and see when your
> expectations aren't met.

-- 
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: Custom Managers and Q() Objects

2011-05-16 Thread Michal Petrucha
On Mon, May 16, 2011 at 09:58:40PM +0200, Marc Aymerich wrote:
> Hi Swawm.
> Thanks for your answer.
> 
> when I call Model.objects.active_during(Q(Q(ini=some_date, end=some_date) |
> Q(ini=other_date, fin=other_date))) I get This error:
> 
> 
> active_during() takes exactly 3 arguments (2 given)
> 
> 
> 
> this is my code:
> 
> class OrderQuerySet(models.query.QuerySet):
> def active_during(self, ini, end):
> return self.filter(Q(register_date__lte = end) &
> Q(Q(cancel_date__isnull=True) | Q(cancel_date__gte = ini
> )))
> 
> class OrderManager(models.Manager):
> # Custom managers with chainable filters.
> # Based on: http://djangosnippets.org/snippets/562/
> 
> def __init__(self, qs_class=models.query.QuerySet):
> super(OrderManager,self).__init__()
> self.queryset_class = qs_class
> 
> def get_query_set(self):
> return self.queryset_class(self.model)
> 
> def __getattr__(self, attr, *args):
> try: return getattr(self.__class__, attr, *args)
> except AttributeError: return getattr(self.get_query_set(), attr,
> *args)
> 
> 
> Seems to me that I need to define active_during() like:
> def active_during(self, *args, **kwargs)
> 
> and make some custom stuff if a Q() object is passed to the method. But what
> I need to do?
In this example, the active_during method is supposed to take two
positional parameters, a start date and an end date. It then creates
the required Q object structure required to represent a filter for
you. What you're doing is passing it one parameter already containing
a Q filter. That is something you'll usually want to pass to a filter,
exclude or get method.

Michal


signature.asc
Description: Digital signature


Re: Custom Managers and Q() Objects

2011-05-16 Thread Michal Petrucha
On Mon, May 16, 2011 at 08:48:45PM +0200, Marc Aymerich wrote:
> Hi,
> my question is, How can I define a custom manager that can handle Q
> objects?

The important thing to realize here is that the default managers proxy
all get, filter and other QuerySet calls to a QuerySet that they
store, usually one without any filters (or in case of RelatedManagers,
containing a filter limiting to the related object).

As such, the Manager class does not in any way have to handle Q
objects, they are ony passed upstream in the process.

Michal


signature.asc
Description: Digital signature


Re: Custom Managers and Q() Objects

2011-05-16 Thread Marc Aymerich
On Mon, May 16, 2011 at 8:53 PM, Shawn Milochik  wrote:

> On 05/16/2011 02:48 PM, Marc Aymerich wrote:
>
>> Hi,
>> my question is, How can I define a custom manager that can handle Q
>> objects?
>>
>> Thanks!
>>
> A custom manager, being a subclass of models.Manager, can already handle Q
> objects in the built-in methods, such as filter and get.
>
> What error are you getting?
>

Hi Swawm.
Thanks for your answer.

when I call Model.objects.active_during(Q(Q(ini=some_date, end=some_date) |
Q(ini=other_date, fin=other_date))) I get This error:


active_during() takes exactly 3 arguments (2 given)



this is my code:

class OrderQuerySet(models.query.QuerySet):
def active_during(self, ini, end):
return self.filter(Q(register_date__lte = end) &
Q(Q(cancel_date__isnull=True) | Q(cancel_date__gte = ini
)))

class OrderManager(models.Manager):
# Custom managers with chainable filters.
# Based on: http://djangosnippets.org/snippets/562/

def __init__(self, qs_class=models.query.QuerySet):
super(OrderManager,self).__init__()
self.queryset_class = qs_class

def get_query_set(self):
return self.queryset_class(self.model)

def __getattr__(self, attr, *args):
try: return getattr(self.__class__, attr, *args)
except AttributeError: return getattr(self.get_query_set(), attr,
*args)


Seems to me that I need to define active_during() like:
def active_during(self, *args, **kwargs)

and make some custom stuff if a Q() object is passed to the method. But what
I need to do?

-- 
Marc

-- 
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: Can't get Django to work on windows XP - I must be missing something obvious!

2011-05-16 Thread Afshin Moshrefi
I figured it out - feel kind of silly
Had to run setup.py in Django directory under Google App Engine
install.


On May 16, 2:05 pm, Afshin Moshrefi  wrote:
> I updated PATH and PYTHONPATH as environmnet variable on windows and
> also by going to python and using append
>
> import sys
> sys.path.append("C:\Program Files\Google\google_appengine\lib
> \django_1_2")
>
> when trying to make a new django project I still get the same error
>
> no module named django.core
>
> I'm wondering if I did something wrong in installation or does
> everyone have this environment issue with Django when installing GAE
> on windows?!
>
> On May 16, 11:50 am, Baurzhan Ismagulov  wrote:
>
>
>
>
>
>
>
> > On Mon, May 16, 2011 at 08:14:09AM -0700, Afshin Moshrefi wrote:
> > > failed again because  django.core import management
> > > ImportError: No module named django.core
>
> > It's #3 
> > inhttp://docs.djangoproject.com/en/dev/topics/install/#installing-the-d...
>
> > I.e., if you unpacked it e.g. under c:\django-1.3, this directory should
> > be in your PYTHONPATH.
>
> > With kind regards,
> > --
> > Baurzhan Ismagulovhttp://www.kz-easy.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.



Show information of subclass in list_display django

2011-05-16 Thread Daiana Marta Marasquin
Hi everybody!

I have two classes in models.py:

class ModelOne(models.Model):
   field_one = models.CharField(max_length=100)
   field_two = models.CharField(max_length=200)
   field_three = models.CharField(max_length=300)
   [...] #other fields
   def __unicode__(self):
   return self.field_one

class ModelTwo(models.Model):
   relation_model_one = models.ForeignKey(ModelOne)
   other_field = models.CharField(max_length=50)
   [...]
   def __unicode__(self):
   return self.relation_model_one.field_one


And your administration in admin.py is this:


class ModelTwoInline(admin.StackedInline):
model = ModelTwo
extra = 0

class ModelOneAdmin(admin.ModelAdmin):
list_display = ('field_one', 'field_two', 'field_three',)
inlines = [ModelTwoInline]


My question is:
I can display the fields of the ModelTwo in list_display of the
ModelOne? (The same for list_filter and search_fields)

I need this because I have many subclasses related to the main class!

Thanks for help!

*And sorry for english!

-- 
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: Set ModelMultipleChoiceField selected in clean()?

2011-05-16 Thread Shawn Milochik
Try putting logging statements at strategic points and see when your 
expectations aren't met.


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



Set ModelMultipleChoiceField selected in clean()?

2011-05-16 Thread Nan
For a formwizard, I'm trying to set the values of a
ModelMultipleChoiceField in the form's clean() method, based on the
cleaned_data from another field, and it's not working.

Here's roughly what I'm trying to do:

# forms.py
from django import forms
from myapp.models import MyModel

class MyForm(forms.Form):
codes = forms.CharField(widget=forms.Textarea)
items =
forms.ModelMultipleChoiceField(queryset=MyModel.objects.all(),
required=False)

def clean_codes(self):
codes = self.cleaned_data.get('codes')
items = []
for code in codes.split():
 try:
 items.append(MyModel.objects.get(code=code)
 except MyModel.DoesNotExist:
 raise forms.ValidationError('Invalid code: %s' %
code)
self.items = items
return codes

def clean(self):
super(MyForm, self).clean()
data = self.cleaned_data
data['items'] = self.items
return data

I've also tried assigning a list of model IDs, a string representation
of model IDs, or a queryset of model objects to data['items'], but
regardless of what I do, the items field returns/displays no values
selected.  Any suggestions?

-- 
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: Custom Managers and Q() Objects

2011-05-16 Thread Shawn Milochik

On 05/16/2011 02:48 PM, Marc Aymerich wrote:

Hi,
my question is, How can I define a custom manager that can handle Q
objects?

Thanks!
A custom manager, being a subclass of models.Manager, can already handle 
Q objects in the built-in methods, such as filter and get.


What error are you getting?


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



Custom Managers and Q() Objects

2011-05-16 Thread Marc Aymerich
Hi,
my question is, How can I define a custom manager that can handle Q
objects?

Thanks!
-- 
Marc

-- 
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: Can't get Django to work on windows XP - I must be missing something obvious!

2011-05-16 Thread Afshin Moshrefi
I updated PATH and PYTHONPATH as environmnet variable on windows and
also by going to python and using append

import sys
sys.path.append("C:\Program Files\Google\google_appengine\lib
\django_1_2")

when trying to make a new django project I still get the same error

no module named django.core

I'm wondering if I did something wrong in installation or does
everyone have this environment issue with Django when installing GAE
on windows?!

On May 16, 11:50 am, Baurzhan Ismagulov  wrote:
> On Mon, May 16, 2011 at 08:14:09AM -0700, Afshin Moshrefi wrote:
> > failed again because  django.core import management
> > ImportError: No module named django.core
>
> It's #3 
> inhttp://docs.djangoproject.com/en/dev/topics/install/#installing-the-d...
>
> I.e., if you unpacked it e.g. under c:\django-1.3, this directory should
> be in your PYTHONPATH.
>
> With kind regards,
> --
> Baurzhan Ismagulovhttp://www.kz-easy.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: how to manage creation of many-to-one (child) objects on separate page during creation of object

2011-05-16 Thread Lucian Nicolescu
I can't say for sure that it does, I didn't need such a feature but I
think it can be customized to support that.

On Mon, May 16, 2011 at 7:40 PM, br  wrote:
> Cool. I'll have to look at that.  Does this support nonlinear form
> flows (i.e., you go from Form1 to Form2 back to Form1 and then hit
> submit) or is there another app for that?
>
>
> On May 16, 7:50 am, Lucian Nicolescu  wrote:
>> Did you check out the form wizard that Django comes 
>> with?http://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/
>> Sounds like this is what you are looking for ... multipage forms.
>>
>> Lucian
>>
>>
>>
>>
>>
>>
>>
>> On Mon, May 16, 2011 at 4:46 PM, br  wrote:
>> > I have not written this yet, so am not posting code (yet).  Also, I am
>> > implementing a client facing interface (not using django admin for
>> > this part).
>>
>> > I am sure this is common thing to do, in fact, I beleive it is done in
>> > django admin, but I am somewhat confused as to the best or standard
>> > way to do it.  Here is the scenario.
>>
>> > I am creating a page for editing and/or creating an object. (we'll
>> > call it a poll, to be consistent with tutorial.)
>> > The page provides a place for user to enter or edit the fields for the
>> > poll corresponding to the model fields.
>> > The Poll model has another model with a foreign key to it. (e.g.
>> > Choice)
>> > On the poll page, I want to show a list of the choices for the poll,
>> > where each choice has a link to edit the choice, and there is also a
>> > link to add a new choice. (for a new poll, there wouldn't be any
>> > choices to start)
>> > The link takes you to a choice page (or pops out a window page) where
>> > you can edit or create the choice.
>> > You hit OK on the choice page to come back to the poll page, which has
>> > a list of choices that is updated with the new choice or the edited
>> > choice.
>> > You don't want to save the choice to the database until the poll is
>> > saved (i.e. they can hit cancel and the poll and any changes to
>> > choices are not saved.)
>>
>> > How to accomplish this "transaction" back and forth between the two
>> > pages, where neither poll nor choices is saved until the Save button
>> > is hit on the Poll page?  Specifically, how to pass the data between
>> > the two pages without explicitly saving each choice to the DB?  Seems
>> > like there is probably a standard mechanism for doing this.
>>
>> > Thanks,
>>
>> > Ben
>>
>> > --
>> > 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 
>> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to manage creation of many-to-one (child) objects on separate page during creation of object

2011-05-16 Thread br
Cool. I'll have to look at that.  Does this support nonlinear form
flows (i.e., you go from Form1 to Form2 back to Form1 and then hit
submit) or is there another app for that?


On May 16, 7:50 am, Lucian Nicolescu  wrote:
> Did you check out the form wizard that Django comes 
> with?http://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/
> Sounds like this is what you are looking for ... multipage forms.
>
> Lucian
>
>
>
>
>
>
>
> On Mon, May 16, 2011 at 4:46 PM, br  wrote:
> > I have not written this yet, so am not posting code (yet).  Also, I am
> > implementing a client facing interface (not using django admin for
> > this part).
>
> > I am sure this is common thing to do, in fact, I beleive it is done in
> > django admin, but I am somewhat confused as to the best or standard
> > way to do it.  Here is the scenario.
>
> > I am creating a page for editing and/or creating an object. (we'll
> > call it a poll, to be consistent with tutorial.)
> > The page provides a place for user to enter or edit the fields for the
> > poll corresponding to the model fields.
> > The Poll model has another model with a foreign key to it. (e.g.
> > Choice)
> > On the poll page, I want to show a list of the choices for the poll,
> > where each choice has a link to edit the choice, and there is also a
> > link to add a new choice. (for a new poll, there wouldn't be any
> > choices to start)
> > The link takes you to a choice page (or pops out a window page) where
> > you can edit or create the choice.
> > You hit OK on the choice page to come back to the poll page, which has
> > a list of choices that is updated with the new choice or the edited
> > choice.
> > You don't want to save the choice to the database until the poll is
> > saved (i.e. they can hit cancel and the poll and any changes to
> > choices are not saved.)
>
> > How to accomplish this "transaction" back and forth between the two
> > pages, where neither poll nor choices is saved until the Save button
> > is hit on the Poll page?  Specifically, how to pass the data between
> > the two pages without explicitly saving each choice to the DB?  Seems
> > like there is probably a standard mechanism for doing this.
>
> > Thanks,
>
> > Ben
>
> > --
> > 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 
> > athttp://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: __unicode__() addition not working in basic poll application.

2011-05-16 Thread AJ
Sorry about that. It is indeed not right. I will take care of this from next
time onwards.

On Mon, May 16, 2011 at 11:45 AM, Fabian Ezequiel Gallina <
galli...@gmail.com> wrote:

> 2011/5/16 AJ :
> > I think you are getting the poll object back. You need to specify the
> method
> > for your model class(es)
> >
> > def __unicode__(self):
> >
> > return "%s %s %s" % (self.poll_name)
> >
> >
>
> That is wrong, you have a placeholder for three args and just pass one
> to the string formatting. Moreover, you don't even need that here.
>
> def __unicode__(self):
>return self.poll_name
>
> Probably a fast-reply kind of error, but that could lead the original
> poster to even get more issues than helping him to solve it.
>
>
>
> Regards,
> --
> Fabián E. Gallina
> http://www.anue.biz
>
> --
> 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.
>
>


-- 
AJ

-- 
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: Can't get Django to work on windows XP - I must be missing something obvious!

2011-05-16 Thread Baurzhan Ismagulov
On Mon, May 16, 2011 at 08:14:09AM -0700, Afshin Moshrefi wrote:
> failed again because  django.core import management
> ImportError: No module named django.core

It's #3 in
http://docs.djangoproject.com/en/dev/topics/install/#installing-the-development-version

I.e., if you unpacked it e.g. under c:\django-1.3, this directory should
be in your PYTHONPATH.

With kind regards,
-- 
Baurzhan Ismagulov
http://www.kz-easy.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: __unicode__() addition not working in basic poll application.

2011-05-16 Thread Fabian Ezequiel Gallina
2011/5/16 AJ :
> I think you are getting the poll object back. You need to specify the method
> for your model class(es)
>
> def __unicode__(self):
>
> return "%s %s %s" % (self.poll_name)
>
>

That is wrong, you have a placeholder for three args and just pass one
to the string formatting. Moreover, you don't even need that here.

def __unicode__(self):
return self.poll_name

Probably a fast-reply kind of error, but that could lead the original
poster to even get more issues than helping him to solve it.



Regards,
-- 
Fabián E. Gallina
http://www.anue.biz

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



Can't get Django to work on windows XP - I must be missing something obvious!

2011-05-16 Thread Afshin Moshrefi
I really must be missing something obvious.   I've installed app
engine on windows xp.  All seems to work until I tried a Django
example!
I first tried to make a django project:

django-admin.py startproject testapp

failed because i think django-admin.py was not not on the path.

I updated windows path to get to the file

failed again because  django.core import management
ImportError: No module named django.core

Please tell me if I forgot to read something somewhere ?!

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: __unicode__() addition not working in basic poll application.

2011-05-16 Thread Gabe
Can it be necessary to recreate a model?

On 16 Maj, 16:32, momo2k  wrote:
> Did you restart the interpreter after adding the code?

-- 
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 list of users in a group admin page

2011-05-16 Thread gontran
Hi Everyone,

I've been searching again and again but I can't figure out how to
display the list of all users in a group admin page. I'd like to
select members of a group directly from this group admin page.

Does anyone knows if it's possible?

Thank you for your help.

Regards,

Gontran

-- 
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: __unicode__() addition not working in basic poll application.

2011-05-16 Thread momo2k
Did you restart the interpreter after adding the code?

-- 
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: __unicode__() addition not working in basic poll application.

2011-05-16 Thread AJ
I think you are getting the poll object back. You need to specify the method
for your model class(es)

def __unicode__(self):
return "%s %s %s" % (self.poll_name)


On Mon, May 16, 2011 at 8:32 AM, maaz muqri  wrote:

> Hi,
> 
> class Poll(models.Model):
># ...
>def __unicode__(self):
>return self.question
>
> class Choice(models.Model):
># ...
>def __unicode__(self):
>return self.choice
> 
>
>
> after adding the above code also I am not able to retrieve the
> question by the command:
>
> I am getting this
>
> >>>Poll.objects.all()
> []
>
>
> instead of this
>
> >>>Poll.objects.all()
> []
>
> --
> 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.
>
>


-- 
AJ

-- 
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: connection lost with concurrent transactions

2011-05-16 Thread otto.vazquez
I just installed RabbitMQ in my local machine (ubuntu 10.10, postgres
8.4.8 and rabbitmq 1.8.0, other stuff is the same version) and
everything worked fine (great!).
So I tried to do the same with the dev environment (centos 5.0 final,
rabbitmq 1.7.2 from epel repo). We have 6 machines: 2 cds (where tasks
are executed), 2 cms and 2 db (master/slave, so only master
accessible).

I have tried different RabbitMQ configuration: just in db master host,
in both cds hosts, in all hosts... no way. Always getting same error:
[2011-05-16 14:20:12,084: WARNING/PoolWorker-1] /usr/lib/python2.6/
site-packages/celery-2.2.4-py2.6.egg/celery/worker/job.py:114:
UserWarning: Exception outside body: : connection already closed
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/celery-2.2.4-py2.6.egg/celery/
worker/job.py", line 108, in execute_safe
return self.execute(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/celery-2.2.4-py2.6.egg/celery/
worker/job.py", line 129, in execute
self.loader.on_process_cleanup()
  File "/usr/lib/python2.6/site-packages/django_celery-2.2.4-py2.6.egg/
djcelery/loaders.py", line 67, in on_process_cleanup
self.close_database()
  File "/usr/lib/python2.6/site-packages/django_celery-2.2.4-py2.6.egg/
djcelery/loaders.py", line 47, in close_database
return django.db.close_connection()
  File "/usr/lib/python2.6/site-packages/django/db/__init__.py", line
85, in close_connection
conn.close()
  File "/usr/lib/python2.6/site-packages/django/db/backends/
__init__.py", line 244, in close
self.connection.close()
InterfaceError: connection already closed
None

So now, I'm not sure if this is a matter of architecture, version bug
or the connector is not working properly.
BTW, we are not using any db middleware (pgpool or pgbouncer mainly)

Any hint before moving to MySQL?

Otto.

On May 13, 8:21 pm, Shawn Milochik  wrote:
> Are you using RabbitMQ as a backend? We're using both Celery and
> django-celery successfully with Django + Postgres and I've never seen
> the issue you describe. We do all our Celery stuff asynchronously, since
> the main point (for us) is to have the user's page load time as short as
> possible.
>
> Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to manage creation of many-to-one (child) objects on separate page during creation of object

2011-05-16 Thread Lucian Nicolescu
Did you check out the form wizard that Django comes with?
http://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/
Sounds like this is what you are looking for ... multipage forms.

Lucian

On Mon, May 16, 2011 at 4:46 PM, br  wrote:
> I have not written this yet, so am not posting code (yet).  Also, I am
> implementing a client facing interface (not using django admin for
> this part).
>
> I am sure this is common thing to do, in fact, I beleive it is done in
> django admin, but I am somewhat confused as to the best or standard
> way to do it.  Here is the scenario.
>
> I am creating a page for editing and/or creating an object. (we'll
> call it a poll, to be consistent with tutorial.)
> The page provides a place for user to enter or edit the fields for the
> poll corresponding to the model fields.
> The Poll model has another model with a foreign key to it. (e.g.
> Choice)
> On the poll page, I want to show a list of the choices for the poll,
> where each choice has a link to edit the choice, and there is also a
> link to add a new choice. (for a new poll, there wouldn't be any
> choices to start)
> The link takes you to a choice page (or pops out a window page) where
> you can edit or create the choice.
> You hit OK on the choice page to come back to the poll page, which has
> a list of choices that is updated with the new choice or the edited
> choice.
> You don't want to save the choice to the database until the poll is
> saved (i.e. they can hit cancel and the poll and any changes to
> choices are not saved.)
>
> How to accomplish this "transaction" back and forth between the two
> pages, where neither poll nor choices is saved until the Save button
> is hit on the Poll page?  Specifically, how to pass the data between
> the two pages without explicitly saving each choice to the DB?  Seems
> like there is probably a standard mechanism for doing this.
>
> Thanks,
>
> Ben
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



how to manage creation of many-to-one (child) objects on separate page during creation of object

2011-05-16 Thread br
I have not written this yet, so am not posting code (yet).  Also, I am
implementing a client facing interface (not using django admin for
this part).

I am sure this is common thing to do, in fact, I beleive it is done in
django admin, but I am somewhat confused as to the best or standard
way to do it.  Here is the scenario.

I am creating a page for editing and/or creating an object. (we'll
call it a poll, to be consistent with tutorial.)
The page provides a place for user to enter or edit the fields for the
poll corresponding to the model fields.
The Poll model has another model with a foreign key to it. (e.g.
Choice)
On the poll page, I want to show a list of the choices for the poll,
where each choice has a link to edit the choice, and there is also a
link to add a new choice. (for a new poll, there wouldn't be any
choices to start)
The link takes you to a choice page (or pops out a window page) where
you can edit or create the choice.
You hit OK on the choice page to come back to the poll page, which has
a list of choices that is updated with the new choice or the edited
choice.
You don't want to save the choice to the database until the poll is
saved (i.e. they can hit cancel and the poll and any changes to
choices are not saved.)

How to accomplish this "transaction" back and forth between the two
pages, where neither poll nor choices is saved until the Save button
is hit on the Poll page?  Specifically, how to pass the data between
the two pages without explicitly saving each choice to the DB?  Seems
like there is probably a standard mechanism for doing this.

Thanks,

Ben

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



__unicode__() addition not working in basic poll application.

2011-05-16 Thread maaz muqri
Hi,

class Poll(models.Model):
# ...
def __unicode__(self):
return self.question

class Choice(models.Model):
# ...
def __unicode__(self):
return self.choice



after adding the above code also I am not able to retrieve the
question by the command:

I am getting this

>>>Poll.objects.all()
[]


instead of this

>>>Poll.objects.all()
[]

-- 
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 FCGI process randomly dying

2011-05-16 Thread Alexander Schepanovski
Do you log django's stdout/stderr. You could do that with --outlog and
--outerr options of runfcgi command

On 16 май, 17:06, Vincent den Boer  wrote:
> Hi,
>
> I'm using Django 1.3 with Lighttpd 1.4.28 via FCGI. It works fine, but the 
> Django
> process tends to die randomly. After it dies I have to manually restart it. 
> Does
> anyone have an idea what could cause this?
>
> Kind regards,
> Vincent den Boer

-- 
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: A Strange Error-auto_now_add

2011-05-16 Thread Burcu Hamamcıoğlu
Ok. We will carry on monitoring it. Thank you very much again.


2011/5/16 Kenneth Gonsalves 

> On Mon, 2011-05-16 at 13:59 +0300, Burcu Hamamcıoğlu wrote:
> > Thank you very much Kenneth. I think this is a one-off error for now.
> > If I
> > face to this problem again I'll use default=datetime.now. But I
> > couldn't
> > understand why this happens? Who causes this problem django middleware
> > or
> > oracle db? Which one supposed to achieve this auto add action?
>
> one-off error could even be a hardware error, operating system error -
> or maybe even oracle background error. We cannot say anything unless it
> reproduces.
> --
> regards
> KG
> http://lawgon.livejournal.com
> Coimbatore LUG rox
> http://ilugcbe.techstud.org/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: A Strange Error-auto_now_add

2011-05-16 Thread Kenneth Gonsalves
On Mon, 2011-05-16 at 13:59 +0300, Burcu Hamamcıoğlu wrote:
> Thank you very much Kenneth. I think this is a one-off error for now.
> If I
> face to this problem again I'll use default=datetime.now. But I
> couldn't
> understand why this happens? Who causes this problem django middleware
> or
> oracle db? Which one supposed to achieve this auto add action? 

one-off error could even be a hardware error, operating system error -
or maybe even oracle background error. We cannot say anything unless it
reproduces.
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

-- 
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: A Strange Error-auto_now_add

2011-05-16 Thread Burcu Hamamcıoğlu
Thank you very much Kenneth. I think this is a one-off error for now. If I
face to this problem again I'll use default=datetime.now. But I couldn't
understand why this happens? Who causes this problem django middleware or
oracle db? Which one supposed to achieve this auto add action?



2011/5/16 Kenneth Gonsalves 

> On Mon, 2011-05-16 at 13:43 +0300, Burcu Hamamcıoğlu wrote:
> > ORACLE.
>
> long ago I used to have a lot of errors where there was an auto_now_add
> field along with an image/file field in the same model. At one time
> auto_now_add was deprecated and we were advised to use
> default=datetime.now. If this is not a one-off error, you may look at
> this work around.
> --
> regards
> KG
> http://lawgon.livejournal.com
> Coimbatore LUG rox
> http://ilugcbe.techstud.org/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: A Strange Error-auto_now_add

2011-05-16 Thread Kenneth Gonsalves
On Mon, 2011-05-16 at 13:43 +0300, Burcu Hamamcıoğlu wrote:
> ORACLE.

long ago I used to have a lot of errors where there was an auto_now_add
field along with an image/file field in the same model. At one time
auto_now_add was deprecated and we were advised to use
default=datetime.now. If this is not a one-off error, you may look at
this work around.
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

-- 
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: A Strange Error-auto_now_add

2011-05-16 Thread Burcu Hamamcıoğlu
ORACLE.


2011/5/16 Kenneth Gonsalves 

> On Mon, 2011-05-16 at 11:31 +0300, Burcu Hamamcıoğlu wrote:
> > I have a project in prodution and a met a strange error last few days.
> > create date of my record's field is
> > "models.DateTimeField(auto_now_add =
> > True)" .  At 15th May a record has been saved to my db and create date
> > of
> > this record has been set to "15.06.6014". I couldn't believe my eyes.
> > What
> > is this ?  6014 wrong year wrong month but day is true.  Do you have
> > any
> > idea?
>
> what db?
> --
> regards
> KG
> http://lawgon.livejournal.com
> Coimbatore LUG rox
> http://ilugcbe.techstud.org/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: A Strange Error-auto_now_add

2011-05-16 Thread Kenneth Gonsalves
On Mon, 2011-05-16 at 11:31 +0300, Burcu Hamamcıoğlu wrote:
> I have a project in prodution and a met a strange error last few days.
> create date of my record's field is
> "models.DateTimeField(auto_now_add =
> True)" .  At 15th May a record has been saved to my db and create date
> of
> this record has been set to "15.06.6014". I couldn't believe my eyes.
> What
> is this ?  6014 wrong year wrong month but day is true.  Do you have
> any
> idea? 

what db?
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django FCGI process randomly dying

2011-05-16 Thread Vincent den Boer
Hi,

I'm using Django 1.3 with Lighttpd 1.4.28 via FCGI. It works fine, but the 
Django 
process tends to die randomly. After it dies I have to manually restart it. 
Does 
anyone have an idea what could cause this?

Kind regards,
Vincent den Boer

-- 
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: File Field

2011-05-16 Thread Mateusz Marzantowicz
On Fri, May 13, 2011 at 1:44 AM, pankaj sharma
wrote:

> Hello friends,.
> i want to upload some files to my database and show it to user ..
> how to add an filefield option to models.py and how to show them in
> admin.py.
> and how to let the users download the files...
>
>
Do you really want to store files directly in database? I think it is a
waste of valuable database storage which is more expensive than file system
storage and also obtaining large amount of file data from database is
inefficient. The better way is to store only references to files placed
somewhere under your MEDIA_ROOT tree.

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



A Strange Error-auto_now_add

2011-05-16 Thread Burcu Hamamcıoğlu
Hi everybody,

I have a project in prodution and a met a strange error last few days.
create date of my record's field is  "models.DateTimeField(auto_now_add =
True)" .  At 15th May a record has been saved to my db and create date of
this record has been set to "15.06.6014". I couldn't believe my eyes. What
is this ?  6014 wrong year wrong month but day is true.  Do you have any
idea?

-- 
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: File Field

2011-05-16 Thread Derek
On May 13, 1:44 am, pankaj sharma  wrote:
> Hello friends,.
> i want to upload some files to my database and show it to user ..
> how to add an filefield option to models.py and how to show them in
> admin.py.
> and how to let the users download the files...
Suggest you start with the docs:
http://docs.djangoproject.com/en/dev/topics/http/file-uploads/
A simple example:
http://www.reddit.com/r/django/comments/fq5qd/looking_to_add_a_single_file_upload_widget_to_the/
A whole app:
https://github.com/rizumu/django-admin-uploads/

-- 
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: MEDIA and STATIC in a nutshell?

2011-05-16 Thread Stuart MacKay

Eiji,

The documentation for MEDIA_URL and STATIC_URL is correct and quite 
clear - once you understand what it is telling you. I also had suffered 
the same confusion when I stated using Django and English is my first 
language.


In general the Django documentation is comprehensive but concise. Each 
sentence has the same level of importance so it is easy to miss an 
important detail in the middle of a paragraph. Happily this confusion 
quickly disappears once you become more familiar with Django and the 
documentation style.


Regards,

Stuart MacKay
Lisbon, Portugal


Shawn,

Thank you. For the compliment and your help. I'll try putting the 
static folder in my apps and try.


Yes, the Japanese documentation is still stuck in 1.0, but there are 
other places to look. But I often use the English docs as last resort, 
because the language is so difficult for us. I have a feeling other 
international people who are interested in Django do the same. I'm 
going to see if I can help in the update process.


That's a shame because I think django/python offers a lot more than 
ruby/rails, which has much better up-to-date documentation in Japan by 
the way. I guess I'm just black sheep.


Thank you again.

Eiji

On Sat, May 14, 2011 at 5:02 PM, Shawn Milochik > wrote:


Eiji,

Sorry to hear about the Japanese translation being out-of-date. I
just checked and saw that it's extremely old. The development of
Django moves too quickly to rely on static documentation. I don't
know of any alternatives to the English version if you want to
remain current, but in any case your English is very good, so at
least you should be able to get by, and this list is usually a big
help.

Shawn



-- 
You received this message because you are subscribed to the Google

Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com
.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.