How to use django-batchimport

2011-06-08 Thread mongoose
Hi there,

I am trying to use django-batchimport that I got from
http://code.google.com/p/django-batchimport/ It's function is to allow
for importing/exporting of data from excel into and out of django
models. There is no documentation on the new version(which is still
not so new). I am hoping other people are using this and can help me
understand how to use it. There is a demo project that one can get off
the app website but it's quite simple and once you have a model
slightly more complicated then it's very difficult to understand what
to do.

Can someone explain to me how to properly how to use the import_dict
line for line? ( How to create the 'object_colmap' and
'relationship_colmap'

For example how would I build up an import_dict for this model? It has
many ForeignKeys, A ManyToMany, DecimalFields and Datetime.
I've tried but run into errors such as "Cannot convert float to
Decimal, convert float to string first" "Too many values to unpack"
and "Expected string but tuple was passed".

class Recipe(models.Model):
EASY_STATUS = 1
MEDIUM_STATUS = 2
HARD_STATUS = 3
DIFFICULTY_CHOICES = (
(EASY_STATUS, 'For the novice'),
(MEDIUM_STATUS, 'So you know how to cook'),
(HARD_STATUS, 'Food is art'),
)

title = models.CharField(max_length=200, help_text='Recipe Name')
description = models.TextField(help_text='Recipe description or
teaser')
serves = models.PositiveSmallIntegerField()
slug = models.SlugField(help_text='This field is automatically
populated from the Title')
difficulty = models.IntegerField(choices=DIFFICULTY_CHOICES,
default=EASY_STATUS)
prep_time = models.DecimalField(decimal_places=2, max_digits=10)
cooking_time = models.DecimalField(decimal_places=2,
max_digits=10)
vegetarian = models.BooleanField()
instructions = models.TextField(help_text='Cooking method')
categories = models.ForeignKey(Category)
tags = TagField(help_text='Tags are seperated by a space')
vat = models.ForeignKey(Vat)
markup = models.ForeignKey(Markup)
albums = models.ManyToManyField('albums')
created_on = models.DateTimeField('date created',
auto_now_add=True)

Thank you very 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.



Re: VERY cheap django hosting?

2011-06-08 Thread raj
Actually, I might reconsider,
What do you guys think of hostgator? They also have django hosting
with fastcgi, And there's is shared hosting. Pros, cons?
Thanks
-Raj
On Jun 9, 12:27 am, raj  wrote:
> Ya, i think as a first timer, I'm gunna go with something that is non-
> vps. I'll learn about preconfiguring stuff when the time comes. I
> think djangohosting.ch looks the best. But asmallorange and alwaysdata
> also look appealing. Thanks all.
>
> On Jun 8, 8:58 pm, ApogeeGMail  wrote:
>
>
>
>
>
>
>
> > +1 for webfaction
> > On Jun 8, 2011, at 8:29 PM, Bobby Roberts wrote:
>
> > > i've been using webfaction.com for a while for $9/mo with one click
> > > django installs.  You can also checkoutwww.slicehost.comifyou want
> > > your own vps and more control.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "Django users" group.
> > > To post to this group, send email 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: VERY cheap django hosting?

2011-06-08 Thread raj
Ya, i think as a first timer, I'm gunna go with something that is non-
vps. I'll learn about preconfiguring stuff when the time comes. I
think djangohosting.ch looks the best. But asmallorange and alwaysdata
also look appealing. Thanks all.

On Jun 8, 8:58 pm, ApogeeGMail  wrote:
> +1 for webfaction
> On Jun 8, 2011, at 8:29 PM, Bobby Roberts wrote:
>
>
>
>
>
>
>
> > i've been using webfaction.com for a while for $9/mo with one click
> > django installs.  You can also checkoutwww.slicehost.comif you want
> > your own vps and more control.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email 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: send_mail issue

2011-06-08 Thread Bobby Roberts
got it... worked like a charm.  i read that but it didn't click the
first time.

thanks again!

On Jun 8, 9:50 pm, David Graves  wrote:
> Fromhttps://docs.djangoproject.com/en/dev/topics/email/#django.core.mail
> like attachments argument should be a list of tuples, so instead of
> attachments=(filename,filecontent,'application/vnd.ms-excel'), try
> attachments=[(filename,filecontent,'application/vnd.ms-excel')].  If that
> doesn't work, just take the attachments argument out, and do:
> message.attach(filename,filecontent,'application/vnd.ms-excel') before your
> message.send
>
> On Wed, Jun 8, 2011 at 7:59 PM, Bobby Roberts  wrote:
> > hey david... that got past he original error but now i'm getting this:
>
> > _create_attachment() takes at most 4 arguments (37 given)
>
> > i think this is happening from the content argument maybe?  any idea
> > how to get around that?
>
> > On Jun 8, 8:38 pm, David Graves  wrote:
> > > from django.core.mail import EmailMessage
>
> > > On Wed, Jun 8, 2011 at 7:35 PM, Bobby Roberts 
> > wrote:
> > > > hi all... i'm trying to send an email attachment and am getting the
> > > > following traceback:
>
> > > > global name 'EmailMessage' is not defined
>
> > > > Here's the code:
>
> > > > [...]
> > > >    from django.core.mail import send_mail
>
> > > >    list2send = mymodel.objects.filter(idNumber = 3)
> > > >    filecontent = render_to_string('template_excel.html',
> > > > {'trs':list2send})
> > > >    filename = 'myfile.xls'
>
> > > >    emailmsg = "See Attached"
> > > >    to_email="x...@.com"
> > > >    subject  = "important email subject here"
> > > >    message = EmailMessage(subject, emailmsg,
> > > > 'fromem...@domainname.com
> > > > ',to_email,attchements=(filename,filecontent,'application/
> > > > vnd.ms-excel'))
>
> > > >    message.send()
>
> > > > am i not importing something?
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Django users" group.
> > > > To post to this group, send email to django-users@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > django-users+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Re: send_mail issue

2011-06-08 Thread David Graves
From
https://docs.djangoproject.com/en/dev/topics/email/#django.core.mail.EmailMessagelooks
like attachments argument should be a list of tuples, so instead of
attachments=(filename,filecontent,'application/vnd.ms-excel'), try
attachments=[(filename,filecontent,'application/vnd.ms-excel')].  If that
doesn't work, just take the attachments argument out, and do:
message.attach(filename,filecontent,'application/vnd.ms-excel') before your
message.send


On Wed, Jun 8, 2011 at 7:59 PM, Bobby Roberts  wrote:

> hey david... that got past he original error but now i'm getting this:
>
> _create_attachment() takes at most 4 arguments (37 given)
>
> i think this is happening from the content argument maybe?  any idea
> how to get around that?
>
>
>
> On Jun 8, 8:38 pm, David Graves  wrote:
> > from django.core.mail import EmailMessage
> >
> > On Wed, Jun 8, 2011 at 7:35 PM, Bobby Roberts 
> wrote:
> > > hi all... i'm trying to send an email attachment and am getting the
> > > following traceback:
> >
> > > global name 'EmailMessage' is not defined
> >
> > > Here's the code:
> >
> > > [...]
> > >from django.core.mail import send_mail
> >
> > >list2send = mymodel.objects.filter(idNumber = 3)
> > >filecontent = render_to_string('template_excel.html',
> > > {'trs':list2send})
> > >filename = 'myfile.xls'
> >
> > >emailmsg = "See Attached"
> > >to_email="x...@.com"
> > >subject  = "important email subject here"
> > >message = EmailMessage(subject, emailmsg,
> > > 'fromem...@domainname.com
> > > ',to_email,attchements=(filename,filecontent,'application/
> > > vnd.ms-excel'))
> >
> > >message.send()
> >
> > > am i not importing something?
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Django 1.3 Email Errors

2011-06-08 Thread Mike
Sorry for the chatter.  I tracked her down.  An easy test is to try:
from django.core import mail
mail.mail_admins('subk','ssdf')

If that doesn't work then the logging won't.

My logging test, was wrong.  I should have used the named logger
'django.request':
logger = logging.getLogger('django.request')
logger.error('test')

finally, my problem, after i found the proper mail log file was simply
a bad server email "root@localhost".  Setting SERVER_EMAIL did the
trick, although I though DEFAULT_FROM_EMAIL would.


Hopefully this will help another fool.


On Jun 8, 12:43 pm, Mike  wrote:
> So am am ready to deploy using apache/modwsgi.  However I noticed that
> I am not getting emailed 500 errors.
>
> In my settings file I have:
>
> LOGGING = {
>     'version': 1,
>     'disable_existing_loggers': False,
>     'handlers': {
>         'mail_admins': {
>             'level': 'ERROR',
>             'class': 'django.utils.log.AdminEmailHandler'
>         }
>     },
>     'loggers': {
>         'django.request': {
>             'handlers': ['mail_admins'],
>             'level': 'ERROR',
>             'propagate': True,
>         },
>     }
>
> }
>
> ADMINS = (
>     # ('Jim Zlogar', 'sa...@yourmom.com'),
> )
> EMAIL_HOST='localhost'
> EMAIL_PORT=25
> MANAGERS = ADMINS
> DEBUG = False
>
> However, the errors are not emailed, but only show up in .
>
> send_mail('Subject here', 'Here is the message.',
> 'f...@example.com',    ['...@example.com'], fail_silently=False) send
> ok and shows up in the logs, however
>
> "logging.error('test') does not send any emails under manage.py
> shell.
>
> Frankly, I am lost on where even to look.  I can't find any errors.
> The smtp server shows no attempts to send email.
>
> Any ideas on what is wrong or where to look?
>
> 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: send_mail issue

2011-06-08 Thread Bobby Roberts
hey david... that got past he original error but now i'm getting this:

_create_attachment() takes at most 4 arguments (37 given)

i think this is happening from the content argument maybe?  any idea
how to get around that?



On Jun 8, 8:38 pm, David Graves  wrote:
> from django.core.mail import EmailMessage
>
> On Wed, Jun 8, 2011 at 7:35 PM, Bobby Roberts  wrote:
> > hi all... i'm trying to send an email attachment and am getting the
> > following traceback:
>
> > global name 'EmailMessage' is not defined
>
> > Here's the code:
>
> > [...]
> >    from django.core.mail import send_mail
>
> >    list2send = mymodel.objects.filter(idNumber = 3)
> >    filecontent = render_to_string('template_excel.html',
> > {'trs':list2send})
> >    filename = 'myfile.xls'
>
> >    emailmsg = "See Attached"
> >    to_email="x...@.com"
> >    subject  = "important email subject here"
> >    message = EmailMessage(subject, emailmsg,
> > 'fromem...@domainname.com
> > ',to_email,attchements=(filename,filecontent,'application/
> > vnd.ms-excel'))
>
> >    message.send()
>
> > am i not importing something?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, 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: VERY cheap django hosting?

2011-06-08 Thread ApogeeGMail
+1 for webfaction
On Jun 8, 2011, at 8:29 PM, Bobby Roberts wrote:

> i've been using webfaction.com for a while for $9/mo with one click
> django installs.  You can also checkout www.slicehost.com if you want
> your own vps and more control.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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: send_mail issue

2011-06-08 Thread David Graves
from django.core.mail import EmailMessage

On Wed, Jun 8, 2011 at 7:35 PM, Bobby Roberts  wrote:

> hi all... i'm trying to send an email attachment and am getting the
> following traceback:
>
> global name 'EmailMessage' is not defined
>
> Here's the code:
>
> [...]
>from django.core.mail import send_mail
>
>list2send = mymodel.objects.filter(idNumber = 3)
>filecontent = render_to_string('template_excel.html',
> {'trs':list2send})
>filename = 'myfile.xls'
>
>emailmsg = "See Attached"
>to_email="x...@.com"
>subject  = "important email subject here"
>message = EmailMessage(subject, emailmsg,
> 'fromem...@domainname.com
> ',to_email,attchements=(filename,filecontent,'application/
> vnd.ms-excel'))
>
>message.send()
>
>
> am i not importing something?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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: send_mail issue

2011-06-08 Thread Kenneth Gonsalves
On Wed, 2011-06-08 at 17:35 -0700, Bobby Roberts wrote:
> global name 'EmailMessage' is not defined

where does 'EmailMessage' come from?
-- 
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: send_mail issue

2011-06-08 Thread Bobby Roberts
that should be

message = EmailMessage(subject,
emailmsg,'fromem...@domainname.com',to_email,attachments=(filename,filecontent,'application/
vnd.ms-excel'))

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



send_mail issue

2011-06-08 Thread Bobby Roberts
hi all... i'm trying to send an email attachment and am getting the
following traceback:

global name 'EmailMessage' is not defined

Here's the code:

[...]
from django.core.mail import send_mail

list2send = mymodel.objects.filter(idNumber = 3)
filecontent = render_to_string('template_excel.html',
{'trs':list2send})
filename = 'myfile.xls'

emailmsg = "See Attached"
to_email="x...@.com"
subject  = "important email subject here"
message = EmailMessage(subject, emailmsg,
'fromem...@domainname.com',to_email,attchements=(filename,filecontent,'application/
vnd.ms-excel'))

message.send()


am i not importing something?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: VERY cheap django hosting?

2011-06-08 Thread Bobby Roberts
i've been using webfaction.com for a while for $9/mo with one click
django installs.  You can also checkout www.slicehost.com if you want
your own vps and more control.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: Parsing feeds that are imported

2011-06-08 Thread Chris McComas
Chris,

Thanks, the django community aggregator is built on top of the
Universal Feed Parser. I figured out the zip codes function of my app.

What I can't figure out is why when I add a m2m model to my
update_feeds.py does not work. As far as I can tell in the
update_feeds doesn't access the Feed model and save it anywhere.

On Jun 7, 10:34 am, Chris Lawlor  wrote:
> I've not used the django community aggregator, so I'm making some
> assumptions about it's functionality. If that app were to emit a
> signal for each feed entry that it processed, it would be fairly
> simple to write a signal handler that would create the associations
> that you want. With this approach, you wouldn't need another cron job,
> your processing would be done at the same time as django community
> aggregator's.
>
> If you do need to do some manual feed parsing, you might try using the
> Universal Feed Parser python module:http://feedparser.org/. It's
> specifically designed for parsing RSS / Atom feeds, and so may be
> somewhat more useful than BeautifulSoup.
>
> On Jun 6, 10:59 pm, Chris McComas  wrote:
>
>
>
>
>
>
>
> > Also, using the update_feeds that's part of the Django Community
> > Aggregator worked initially, but I started over adding a m2m field on
> > the Feed model for Sites. I'll have several "sites" as part of the
> > Django app, like team1.mysite.com, team2.mysite.com, etc.
>
> > When I added that field to the models and tried to run the
> > update_feeds script it did nothing. It didn't import the feeds, didn't
> > throw an error, etc.
>
> > update_feeds:https://github.com/django/djangoproject.com/blob/master/django_websit...
> > my models:http://dpaste.com/551322/
>
> > Thanks,
>
> > On Jun 6, 4:55 pm, Chris McComas  wrote:
>
> > > This could be the wrong place to ask (maybe a BeautifulSoup)
> > > question...
>
> > > I have a Django app that is based around the Django Community
> > > Aggregator, it gets feeds from various sites and displays them on my
> > > site. What I am wanting to do, if possible, is when it gets a feed if
> > > a certain zip code is the feed Title or Summary then I want to create
> > > a entry for that zipcode with that feed?
>
> > > I have a model for the zip codes, so the list to compare should be
> > > pulled from that. There'd be a cron that'd run to do this, so for
> > > example if one of the zip codes is 12345 and one of the feeds it gets
> > > on the hourly cron has 12345 in the summary, then it'd go to the model
> > > linking the two and create/save an entry.
>
> > > Here are the pertinent models:http://dpaste.com/551223/
>
> > > 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: VERY cheap django hosting?

2011-06-08 Thread Alasdair Nicol
I have used djangohosting.ch before and recommend them. As BR says it's 
very easy to deploy, and I thought their support was super.


Alasdair

On 08/06/11 22:13, Tiago Almeida wrote:

I use http://djangohosting.ch/ for a small company website and haven't
experienced any issues on the last 4 months.
It is a shared hosting account but the machine is quite beefy and
always idle :)
you pay 12€ every 3 months.
It is very easy to deploy django project there, unlike vps where you
have to configure everything.
BR,


On Jun 8, 7:30 am, raj  wrote:

Hey guys,
Just wondering if you could give me some hosts that are very cheap for
django hosting? Is hostgator any good? I really don't know what to
look for in a host. A lot of people are recommending web faction, but
its around $9 bucks a month. I was looking in the $5 bucks a month
range. Any ideas? Thank you.
-Raj



--
Alasdair Nicol
Developer, MEMSET Dedicated Hosting

mail: alasd...@memset.com
 web: http://www.memset.com/

Memset Ltd., registration number 4504980. 25 Frederick Sanger Road, Guildford, 
Surrey, GU2 7YD, UK.

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



Re: VERY cheap django hosting?

2011-06-08 Thread Tiago Almeida
I use http://djangohosting.ch/ for a small company website and haven't
experienced any issues on the last 4 months.
It is a shared hosting account but the machine is quite beefy and
always idle :)
you pay 12€ every 3 months.
It is very easy to deploy django project there, unlike vps where you
have to configure everything.
BR,


On Jun 8, 7:30 am, raj  wrote:
> Hey guys,
> Just wondering if you could give me some hosts that are very cheap for
> django hosting? Is hostgator any good? I really don't know what to
> look for in a host. A lot of people are recommending web faction, but
> its around $9 bucks a month. I was looking in the $5 bucks a month
> range. Any ideas? Thank you.
> -Raj

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: ImageField issue

2011-06-08 Thread Greg Donald
On Wed, Jun 8, 2011 at 2:51 PM, Daniel Roseman  wrote:
> But that "bunch of image data" is a string - because that's what .read()
> returns.
> The FileField documentation [1] shows how to save a disk file to a field:
>     from django.core.files import File
>     f = open('/tmp/hello.world')
>     myfile = File(f)
>     et.image.save( image_name, myfile )
>
> https://docs.djangoproject.com/en/1.3/ref/models/fields/#django.db.models.FieldFile.save


I see now.. got it working.

Thanks.


-- 
Greg Donald
destiney.com | gregdonald.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: [Django 1.2] Admin ForeignKey edit link?

2011-06-08 Thread Micky Hulse
On Wed, Jun 8, 2011 at 12:51 PM, Micky Hulse  wrote:
> Looks like ticket #13165 is the way to go, but I thought I would ask
> the group before I consider applying the patch.

Ooops, here's the link to the ticket:



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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 1.2] Admin ForeignKey edit link?

2011-06-08 Thread Micky Hulse
Hi,

Looks like ticket #13165 is the way to go, but I thought I would ask
the group before I consider applying the patch.

I would love to have an "edit" pencil link for my model's FKs.

Other than applying the patch, are there any good work-arounds out there?

I was considering extending/overriding the Django admin templates, but
that just seems like overkill (I don't have a lot of time to spend on
this).

Could I somehow get the model PK and insert that into my FK's
"help_text" as an href?

Anyone out there been in a similar predicament? Did you apply the #13165 patch?

Does 1.3 have this feature (looking at the ticket, I assume the answer is "no")?

Any tips?

Thanks so much!

Cheers,
Micky

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: ImageField issue

2011-06-08 Thread Daniel Roseman
On Wednesday, 8 June 2011 20:40:35 UTC+1, Greg Donald wrote:
>
> I have a model EventType that has an ImageField named image.
>
> When I post my image upload form I can upload an image with no problems.
>
>
> But when I try to save() an image from the file system I get the error:
>
> 'str' object has no attribute 'chunks'
>
>
> Here is my code:
>
> et = EventType( name=name )
> et.save()
>
> image_name = "%s.png" % name
> image_path = "%s/images/%s.png" % ( settings.MEDIA_ROOT, name )
> image_file = open( image_path, 'rb' )
>
> et.image.save( image_name, image_file.read() )
>
>
> I'm sure the file exists and is readable.
>
> I'm not sure why image_file.read() is returning a str, it spews a
> bunch of what appears to be image data when I debug it.
>
> Any idea what I'm doing wrong?
>
>
> Thanks.
>
 
But that "bunch of image data" is a string - because that's what .read() 
returns. 

The FileField documentation [1] shows how to save a disk file to a field:

from django.core.files import File
f = open('/tmp/hello.world')
myfile = File(f)
et.image.save( image_name, myfile )

https://docs.djangoproject.com/en/1.3/ref/models/fields/#django.db.models.FieldFile.save
--
DR.

>

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



ImageField issue

2011-06-08 Thread Greg Donald
I have a model EventType that has an ImageField named image.

When I post my image upload form I can upload an image with no problems.


But when I try to save() an image from the file system I get the error:

'str' object has no attribute 'chunks'


Here is my code:

et = EventType( name=name )
et.save()

image_name = "%s.png" % name
image_path = "%s/images/%s.png" % ( settings.MEDIA_ROOT, name )
image_file = open( image_path, 'rb' )

et.image.save( image_name, image_file.read() )


I'm sure the file exists and is readable.

I'm not sure why image_file.read() is returning a str, it spews a
bunch of what appears to be image data when I debug it.

Any idea what I'm doing wrong?


Thanks.


-- 
Greg Donald
destiney.com | gregdonald.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: ANN: django-supervisor: easy integration between django and supervisord

2011-06-08 Thread Ethan Jucovy
This is really excellent - thanks for releasing it.

-Ethan

On Tue, Jun 7, 2011 at 10:51 PM, Ryan Kelly  wrote:

>
> Hi All,
>
>
>  I've just released a little experiment in combining the process
> management awesomeness of supervisord with the convenience of Django's
> management scripts.  It's called, funnily enough, django-supervisor:
>
>  http://pypi.python.org/pypi/django-supervisor/
>
>
>  The concept is simple:  instead of having supervisord in charge of
> Django, why not put Django in charge of supervisord?
>
>
>  If you've got a Django project that needs to keep several processes
> running at once (e.g. celeryd or celerybeat) then this might be the app
> for you.  You can:
>
>   * manage all your processes with `python manage.py supervisor`.
>
>   * keep your process definitions and configuration inside your
> Django project directory.
>
>   * use Django's template system to construct the supervisord config
> file, interpolating environment variables or settings as you need.
>
>   * merge pre-defined configuration files from all the INSTALLED_APPS,
> and tweak or override them on a per-project basis.
>
>   * auto-reload all running processes when your code changes
>(but only in debug mode of course)
>
>
>  All comments, questions, feedback and criticism welcome.  I hope you
> find it useful.
>
>
>  Cheers,
>
>  Ryan
>
> --
> Ryan Kelly
> http://www.rfk.id.au  |  This message is digitally signed. Please visit
> r...@rfk.id.au|  http://www.rfk.id.au/ramblings/gpg/ for details
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: VERY cheap django hosting?

2011-06-08 Thread Nan
Seconding the suggestion of asmallorange.com -- one of the best
inexpensive hosts I've used.  I haven't run Django on their servers,
but it can be made to run using FastCGI (there are instructions on
their wiki somewhere).

On Jun 8, 2:30 am, raj  wrote:
> Hey guys,
> Just wondering if you could give me some hosts that are very cheap for
> django hosting? Is hostgator any good? I really don't know what to
> look for in a host. A lot of people are recommending web faction, but
> its around $9 bucks a month. I was looking in the $5 bucks a month
> range. Any ideas? Thank you.
> -Raj

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: best framework/reusable app for caching model instances (object level cache) ?

2011-06-08 Thread Nan

I'm looking into caching options at the moment too.  Did you end up
using django-cache-utils?  Is it working out for you?

On May 17, 12:36 pm, stargazer  wrote:
> After looking at these libraries... I think the best solution would be
> not use these kind of libraries (ORMcache) at all.
>
> The @cached decorator like from this library:
>    https://bitbucket.org/kmike/django-cache-utils
> caches ***and invalidates!*** function based on function name and
> exact parameter set.
>
> my idea is to add @cached decorators to the model manager methods and
> call ...invalidate for these methods in post_save() and pre_delete()
> Some manual work required, but the end result is quite transparent.
>
> Somebody use this approach?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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 1.3 Email Errors

2011-06-08 Thread Mike
So am am ready to deploy using apache/modwsgi.  However I noticed that
I am not getting emailed 500 errors.

In my settings file I have:

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}

ADMINS = (
# ('Jim Zlogar', 'sa...@yourmom.com'),
)
EMAIL_HOST='localhost'
EMAIL_PORT=25
MANAGERS = ADMINS
DEBUG = False


However, the errors are not emailed, but only show up in .

send_mail('Subject here', 'Here is the message.',
'f...@example.com',['t...@example.com'], fail_silently=False) send
ok and shows up in the logs, however

"logging.error('test') does not send any emails under manage.py
shell.

Frankly, I am lost on where even to look.  I can't find any errors.
The smtp server shows no attempts to send email.

Any ideas on what is wrong or where to look?

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: Trouble with simple aggregation

2011-06-08 Thread Ian Clelland
On Wed, Jun 8, 2011 at 10:11 AM, Thomas Weholt wrote:

> Say I got a model like so:
>
> class Article(models.Model):
>title = models.CharField(max_length=100)
>text = models.TextField()
>category = models.CharField(max_length=20)
>author = models.CharField(max_length=50)
>
> Article.objects.create(title="Foo", text="Story about foo",
> category="adventure", author="jane")
> Article.objects.create(title="Bar", text="Story about bar",
> category="adventure", author="joe")
> Article.objects.create(title="Cheese", text="Story about cheese",
> category="adventure", author="joe")
> Article.objects.create(title="Perl", text="Story about perl",
> category="horror", author="jane")
> Article.objects.create(title="Java", text="Story about java",
> category="horror", author="joe")
> Article.objects.create(title="Pizza", text="Story about pizza",
> category="cooking", author="joe")
>
> I've tried to use aggregation to find how many articles written by joe
> there are of each category, but so far I'm not getting anywhere.
>
> Desired output:
>
> [
>{'category': 'adventure', 'count': 2},
>{'category': 'horror', 'count': 1},
>{'category': 'cooking', 'count': 1}
> ]
>
> I just cant get my head wrapped around the orm aggregation, in this is
> easy using raw SQL, but I don't want to.
>

Is this not something like:

Article.objects.values('category').annotate(count=models.Count('id'))

? The idea being that you group the objects by category, and then count the
number of distinct ids within each category.

The docs mention that the default ordering can get in the way of this
sometimes, so you probably want to clear it first, like this:

Article.objects.values('category').annotate(count=models.Count('id')).order_by()

That should get you all of the data for your desired output -- it might not
be an actual list of actual dicts, but it should be structured in the same
way.

-- 
Regards,
Ian Clelland


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: VERY cheap django hosting?

2011-06-08 Thread Anoop Thomas Mathew
Hi all,
It would be a good idea to check out hostrail.com which provides really
cheap vps' . I've been using it for last 6+ months and seems to be pretty
good @ 1.4$/month for 256 MB vps.
You can easily fetch some good promos to get cheap rates from them.

Regards,
Anoop Thomas Mathew
On 8 Jun 2011 19:36, "roberto"  wrote:
> http://www.asmallorange.com/
>
> On Jun 8, 10:17 am, Chris Lawlor  wrote:
>> Always Data (http://www.alwaysdata.com) has a free plan, but it is
>> quite limited (you only get 10 MB disk space).
>>
>> On Jun 8, 2:39 am, Maksymus007  wrote:
>>
>>
>>
>>
>>
>>
>>
>> > megiteam.pl is 24PLN which is about 8usd a month:)
>>
>> > Pozdrawiam, Maksymilian Pawlak
>> > 08-06-2011 08:30 użytkownik "raj"  napisał:> Hey
guys,
>> > > Just wondering if you could give me some hosts that are very cheap
for
>> > > django hosting? Is hostgator any good? I really don't know what to
>> > > look for in a host. A lot of people are recommending web faction, but
>> > > its around $9 bucks a month. I was looking in the $5 bucks a month
>> > > range. Any ideas? Thank you.
>> > > -Raj
>>
>> > > --
>> > > You received this message because you are subscribed to the Google
Groups
>>
>> > "Django users" group.> To post to this group, send email to
django-users@googlegroups.com.
>> > > To unsubscribe from this group, 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.



Trouble with simple aggregation

2011-06-08 Thread Thomas Weholt
Say I got a model like so:

class Article(models.Model):
title = models.CharField(max_length=100)
text = models.TextField()
category = models.CharField(max_length=20)
author = models.CharField(max_length=50)

Article.objects.create(title="Foo", text="Story about foo",
category="adventure", author="jane")
Article.objects.create(title="Bar", text="Story about bar",
category="adventure", author="joe")
Article.objects.create(title="Cheese", text="Story about cheese",
category="adventure", author="joe")
Article.objects.create(title="Perl", text="Story about perl",
category="horror", author="jane")
Article.objects.create(title="Java", text="Story about java",
category="horror", author="joe")
Article.objects.create(title="Pizza", text="Story about pizza",
category="cooking", author="joe")

I've tried to use aggregation to find how many articles written by joe
there are of each category, but so far I'm not getting anywhere.

Desired output:

[
{'category': 'adventure', 'count': 2},
{'category': 'horror', 'count': 1},
{'category': 'cooking', 'count': 1}
]

I just cant get my head wrapped around the orm aggregation, in this is
easy using raw SQL, but I don't want to.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: tuple comparison to make one tuple

2011-06-08 Thread Jason Culverhouse

On Jun 8, 2011, at 9:41 AM, Tom Evans wrote:

> On Wed, Jun 8, 2011 at 5:34 PM, MikeKJ  wrote:
>> 
>> I have 3 tuples of email addresses, I want to compare the 3 against each
>> other to make a single tuple of email addresses with no duplicates, any
>> ideas?
> 
 t1 = ( 'a...@b.com', 'b...@b.com', 'c...@b.com' )
 t2 = ( 'a...@b.com', 'a...@c.com', )
 t3 = ( 'a...@c.com', )
 set(t1) | set(t2) | set(t3)
> set(['a...@c.com', 'c...@b.com', 'a...@b.com', 'b...@b.com'])
> 

Depending on the size of the tuples, you can avoid creating extra sets
(5 in the example above) with:

from itertools import chain
set(chain(t1, t2, t3))

Just adding a vote here for other recipes in itertools, 
http://docs.python.org/library/itertools.html#recipes

You could use unique_everseen, still creates a set, but might be useful
if you intention is only to iterate through the remaining list.

# overkill for example...
tuple(unique_everseen(chain(t1, t2, t3)))
('a...@b.com', 'b...@b.com', 'c...@b.com', 'a...@c.com')

Jason Culverhouse
http://www.mischievous.org

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: tuple comparison to make one tuple

2011-06-08 Thread Tom Evans
On Wed, Jun 8, 2011 at 5:34 PM, MikeKJ  wrote:
>
> I have 3 tuples of email addresses, I want to compare the 3 against each
> other to make a single tuple of email addresses with no duplicates, any
> ideas?

>>> t1 = ( 'a...@b.com', 'b...@b.com', 'c...@b.com' )
>>> t2 = ( 'a...@b.com', 'a...@c.com', )
>>> t3 = ( 'a...@c.com', )
>>> set(t1) | set(t2) | set(t3)
set(['a...@c.com', 'c...@b.com', 'a...@b.com', 'b...@b.com'])


Cheers

Tom

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



tuple comparison to make one tuple

2011-06-08 Thread MikeKJ

I have 3 tuples of email addresses, I want to compare the 3 against each
other to make a single tuple of email addresses with no duplicates, any
ideas?
-- 
View this message in context: 
http://old.nabble.com/tuple-comparison-to-make-one-tuple-tp31802229p31802229.html
Sent from the django-users mailing list archive at Nabble.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: Add custom html between two model fields in Django admin's change_form

2011-06-08 Thread christian.posta
Well, there are a couple things you could do:

for the PresupuestoAdminForm, you could do this to the CharField:
name = forms.CharField(max_length=100,
widget=forms.TextInput(attrs={'readonly': 'readonly'}))
(note the CharField is from the 'forms' package, not the 'models'
you'll also need to remove the 'name' entry from the readonly_fields
tuple)

Alternatively, you could ignore using the custom ModelForm, and add
the 'name' field directly to the PresupuestoAdmin class. In that case
you can use the readonly_fields tuple.

I would probably go with the first choice since it will allow you to
write a custom query to populate the field in the constructor.

Example:

class StoreAdminForm(forms.ModelForm):
test = forms.CharField(max_length=100,
widget=forms.TextInput(attrs={'readonly': 'readonly'}))

def __init__(self, *args, **kwargs):
super(StoreAdminForm, self).__init__(*args, **kwargs)

if kwargs.has_key('instance'):
instance = kwargs['instance']
# do something with the instance here, like use it to
calculate something,
# then set the value on the 'test' field using
self.fields['test']

class Meta:
model = Store

Good luck!

On Jun 7, 9:16 am, mf  wrote:
> Thanks christian. I've followed your good advice but I don't know why
> am I getting  this error: "PresupuestoAdmin.readonly_fields[1], 'name'
> is not a callable or an attribute of 'PresupuestoAdmin' or found in
> the model 'Presupuesto' ". It seems that the 'name' field is not added
> to the form used by the admin.
>
> class PresupuestoAdminForm(forms.ModelForm):
>     name = models.CharField(max_length=100)
>
>     class Meta:
>         model = Presupuesto
>
> class PresupuestoAdmin(admin.ModelAdmin):
>     form = PresupuestoAdminForm
>
>     fieldsets = (
>         (None, {
>             'fields': (('id', 'fecha_emision', ), ('obra',
> 'num_pres_ext',),
>             'proveedor', 'descripcion', 'observaciones',
> 'importe_contratado',)
>         }),
>     )
>     readonly_fields = ('id', 'name',)
>
> admin.site.register(Presupuesto, PresupuestoAdmin)
>
> On 7 jun, 11:11, "christian.posta"  wrote:
>
>
>
>
>
>
>
> > Create a different ModelForm that contains your readonly fields (and
> > populate them however you want) and set this on your ModelAdmin form.
>
> > See the ModelAdmin.form option in the 
> > docs.https://docs.djangoproject.com/en/1.2/ref/contrib/admin/#modeladmin-o...
>
> > On Jun 7, 6:01 am, mf  wrote:
>
> > > Let's say I've two models:
>
> > >     class Book(models.Model):
> > >         name = models.CharField(max_length=50)
> > >         library = models.ForeignKeyField('Library')
>
> > >     class Library(models.Model):
> > >         name = models.CharField(max_length=50)
> > >         address = models.CharField(max_length=50)
> > >         tel = models.CharField(max_length=50)
>
> > > Is there a nice way to add some html(a readonly input field) between
> > > name and address in the Library change_form template?. I'm doing it
> > > overriding [admin/includes/fieldset.html][1] but it's getting messy
> > > and I can't find a way to display the html exactly where I want to.
> > > For example, if I want to add html displaying the amount of books that
> > > the library has below the name field I woul do this:
>
> > >     {% for field in line %}
> > >         ...
> > >         {% if field.field.name == 'name' %}
> > >             {{ field.field }}
> > >             
> > >                 
> > >                     Total books:
> > >                      > > id="totbooks" readonly="readonly">
> > >                 
> > >            
> > >         {% else %}
> > >             {{ field.field }}
> > >         {% endif %}
> > >         ...
> > >     {% endfor %}
>
> > >   
> > > [1]:https://code.djangoproject.com/browser/django/trunk/django/contrib/ad...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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 Class Based FormView and multiple forms

2011-06-08 Thread Michel Thadeu Sabchuk
Hi guys,

Is there a general guideline to work with class based generic views
and multiple forms? I already use FormView but it seems focused on a
single form.

Suppose a user profile registration: with function based views, I use
two forms, one for the user account and other for the profile.

I can start directly on the TemplateView or I can fill the FormView
with 2 forms (with some customization) but, before it, I want to know
if anyone didn't find a better way to do it ;)

Some recommendation?

Best regards.

--
Michel Sabchuk
Curitiba - Brasil
http://turbosys.com.br/

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



Django Inline Autocomplete

2011-06-08 Thread George Cummins
Is it possible to filter an inline autocomplete field by a dynamic
value entered by a user?

For example, I have a an admin form where staff enters games
information including home and visiting team, game date and time,
score, etc. They also enter individual player names and stats. I would
like to add a filter to show only the players on either the home or
visiting team.

I am using the InlineAutocompleteAdmin module (http://jannisleidel.com/
2008/11/autocomplete-form-widget-foreignkey-model-fields/), which
provides autocomplete hints for input fields.

Here is the current inline autocomplete code:

class IndividualFootballGameInline(InlineAutocompleteAdmin):
model = IndividualFootballGame
extra = 1
related_search_fields = {
'player': ('player__first_name', 'player__last_name',
'#team__sport__sport=Football',
'#team__season__season_start_date__year=' +
str(get_current_season_start_year('football'))),
}
If this can be accomplished, can you help me understand how?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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 solved tutorial for download??

2011-06-08 Thread Pardini Andres
Hi guys,

I am looking for django tutorial solved, for downloading

If anyone has a link, please share it :)

Cheers!!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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: VERY cheap django hosting?

2011-06-08 Thread roberto
http://www.asmallorange.com/

On Jun 8, 10:17 am, Chris Lawlor  wrote:
> Always Data (http://www.alwaysdata.com) has a free plan, but it is
> quite limited (you only get 10 MB disk space).
>
> On Jun 8, 2:39 am, Maksymus007  wrote:
>
>
>
>
>
>
>
> > megiteam.pl is 24PLN which is about 8usd a month:)
>
> > Pozdrawiam, Maksymilian Pawlak
> > 08-06-2011 08:30 użytkownik "raj"  napisał:> Hey guys,
> > > Just wondering if you could give me some hosts that are very cheap for
> > > django hosting? Is hostgator any good? I really don't know what to
> > > look for in a host. A lot of people are recommending web faction, but
> > > its around $9 bucks a month. I was looking in the $5 bucks a month
> > > range. Any ideas? Thank you.
> > > -Raj
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
>
> > "Django users" group.> To post to this group, send email to 
> > django-users@googlegroups.com.
> > > To unsubscribe from this group, 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: VERY cheap django hosting?

2011-06-08 Thread Chris Lawlor
Always Data (http://www.alwaysdata.com) has a free plan, but it is
quite limited (you only get 10 MB disk space).

On Jun 8, 2:39 am, Maksymus007  wrote:
> megiteam.pl is 24PLN which is about 8usd a month:)
>
> Pozdrawiam, Maksymilian Pawlak
> 08-06-2011 08:30 użytkownik "raj"  napisał:> Hey guys,
> > Just wondering if you could give me some hosts that are very cheap for
> > django hosting? Is hostgator any good? I really don't know what to
> > look for in a host. A lot of people are recommending web faction, but
> > its around $9 bucks a month. I was looking in the $5 bucks a month
> > range. Any ideas? Thank you.
> > -Raj
>
> > --
> > You received this message because you are subscribed to the Google Groups
>
> "Django users" group.> To post to this group, send email to 
> django-users@googlegroups.com.
> > To unsubscribe from this group, 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.



Bug? Duplicate search results in admin when ManyToMany relationships are used

2011-06-08 Thread Nikolai Prokoschenko
Hello,

yesterday, I tried upgrading my project to Django 1.3 from 1.2.4. One 
peculiar problem has arised: when I searched for users in the admin area, I 
suddenly had duplicated search results for some users. After comparing the 
queries with 1.2.4 it seems to me that a DISTINCT clause has been missing 
from the query. I could track the problem down to my UserProfile class: I 
used 'userprofile__groups__name' as search field in the my UserCustomAdmin 
(these are custom user groups, not the ones from contrib.auth), which lead 
to JOINs, which used to be DISTINCTed in 1.2.X, but in 1.3 are not anymore. 
Removing 'userprofile__groups__name' has solved the problem, however, there 
are no JOINs anymore either.

Can anyone pinpoint a change in 1.3 which leads to this behaviour? What 
should I do to prevent multiple results if I ever needed to be able to 
search in ManyToMany fields?

Thanks.

Nikolai.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/VUpFb2tpcFFxOTRK.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, 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 transactions.

2011-06-08 Thread Marc Aymerich
On Tue, Jun 7, 2011 at 11:53 PM, Malcolm Box  wrote:
> n 7 June 2011 15:16, Marc Aymerich  wrote:
>>
>> Hi,
>> I've activated the
>> 'django.middleware.transaction.TransactionMiddleware' and I've
>> decorated one method with @transaction.commit_on_success
>> With this I expect that if the method raise an exception, django rolls
>> back any database operation executed by this method, even the
>> operations executed by submethods called by this main method, right?
>> So I got this exception but the changes made on the DB during the
>> method execution still there.
>>
>
> What database are you using? Does it support transactions?
>

Hi Malcolm and Christophe,
You're right :) I'm using Mysql with myisam, I'm going to switch to
InnoDB engine and try again.

I thought that the transaction stuff were implemented in python and
doesn't relay on DB backend. :(


-- 
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: VERY cheap django hosting?

2011-06-08 Thread Maksymus007
megiteam.pl is 24PLN which is about 8usd a month:)

Pozdrawiam, Maksymilian Pawlak
08-06-2011 08:30 użytkownik "raj"  napisał:
> Hey guys,
> Just wondering if you could give me some hosts that are very cheap for
> django hosting? Is hostgator any good? I really don't know what to
> look for in a host. A lot of people are recommending web faction, but
> its around $9 bucks a month. I was looking in the $5 bucks a month
> range. Any ideas? Thank you.
> -Raj
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, 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.



VERY cheap django hosting?

2011-06-08 Thread raj
Hey guys,
Just wondering if you could give me some hosts that are very cheap for
django hosting? Is hostgator any good? I really don't know what to
look for in a host. A lot of people are recommending web faction, but
its around $9 bucks a month. I was looking in the $5 bucks a month
range. Any ideas? Thank you.
-Raj

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