Re: effective adding records in Django site admin

2011-10-05 Thread veva...@yandex.ru
Thank You very much! Adding option "save_as = True" to ModelAdmin
subclass is exactly what I need.

On 4 окт, 13:01, Thomas Orozco  wrote:
> Regarding your first question, the admin save_as field does exactly this.
> Le 4 oct. 2011 07:01, "veva...@yandex.ru"  a écrit :

-- 
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: effective adding records in Django site admin

2011-10-05 Thread veva...@yandex.ru
Thank You very much! Tell me please what directory is to be used to
place such extensions

On 4 окт, 12:02, Ilian Iliev  wrote:
> Hi,
>
> you can always create custom admin page for your models by extending
> the default admin.
>
> --
> eng. Ilian Iliev
> Web Software Developer
>
> Mobile: +359 88 66 08 400
> Website:http://ilian.i-n-i.org
>
>
>
>
>
>
>
> On Tue, Oct 4, 2011 at 8:01 AM, veva...@yandex.ru  wrote:
> > Good morning!
> > Could you tell me, is there any solution to add several records?
> > 1) Now we can click Add, this gives us an empty version of the edit
> > page. I believe it is comfortable to have a Copy button, clicking Copy
> > would give us a page with a copy of a previuosly selected record, we
> > could edit several fields in it and save a new record.
> > 2) One more comfortable tool, I believe, would be 2-dimensional form
> > for group addings records: rows corresponds to one field, columns to
> > another, cells to third. Saving such a form would create several
> > records, one for every filled cell.
> > May be such solutions are exist ? If not, could you give me any
> > advice?
> > 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.

-- 
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: Report tool is supported for django .

2011-10-05 Thread Le Huu Nghia
Thanks so much for your help.

On Tue, Oct 4, 2011 at 6:35 PM, BILLION Sébastien <
sebastien.bill...@gmail.com> wrote:

>  Here:
>
> https://docs.djangoproject.com/en/dev/howto/outputting-pdf/
>
>
>
>  BILLION Sébastien
>
> the Answer to the ultimate question of life, the universe and everything is
> **42**
>
> http://www.sebastienbillion.com/
>
> Le 04/10/2011 12:33, Phang Mulianto a écrit :
>
> i remember there is how to output to pdf in the documentation..  should
> there any ready to use tool out there..will be nice..
>  On Oct 4, 2011 5:03 PM, "Le Huu Nghia"  wrote:
> > Dear all,
> >
> > I need to make a report with django .
> > This report supports (chart , export PDF, Excell ...,)
> > please give me some recommendations with tool i must use for this case.
> >
> > Thanks in advance.
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Iteration over queryset in a model

2011-10-05 Thread Daniel Roseman


On Wednesday, 5 October 2011 01:27:54 UTC+1, eyscooby wrote:
>
> new to django/python developement, can't get this one figured out. 
>
> I have a model that has a couple DateFields (issued_date & 
> completion_date), and I'm trying to return a value with the difference 
> of the two on each entry that is complete, and then if it isn't 
> completed yet, show the amount of days since it was issued. 
> I am using the Admin interface and what I have in the model is 
> this 
>
> models.py 
> class RequestTicket(models.Model): 
> . . . 
> issued_date = DateField() 
> completed_date = DateField(blank=True, null=True) 
>
> def days_old(self): 
> complete = RequestTicket.object.filter(completion_date__isnull=False) 
> for ticket in complete: 
> return ticket.completion_date - ticket.issued_date 
> return date.today() - self.issued.date 
> days_old.short_discription = 'Days Old' 
>
> what i get returned is if the first entry was completed within 2 days 
> (issued=9/14, completed=9/16), all entries after that get 2 days, even 
> if there is no completion date. 
> If i use 'self.object.filter(completion_date__isnull=False)', I get a 
> NONE answer on all entries 
> If I don't filter for just completed entries I get an error trying to 
> subtract NoneType field with DateField, i guess that might be from the 
> NULL setting. 
> Any help, advice would be great, or if i need to post in another area. 
>
> Django version 1.2 
>
> thanks 
> Kenney



OK, there are a few things wrong with your `days_old` function.

Firstly, it operates on a queryset, not an instance, so it should be a 
method of the Manager, not the Model.  

Secondly, you can't return multiple times like that. You can only return 
once from a function. You need to build up a list of values, and return that 
- or set the attribute on each element of the queryset.
--
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/-/9tyTV8dq-B8J.
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: (argh!!) Fwd: Undelivered Mail Returned to Sender

2011-10-05 Thread Kurtis Mullins
+1 Thanks for the fix :)

On Tue, Oct 4, 2011 at 9:13 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Nice one - thank you for sorting this out Russell, was driving me a bit
> nuts!
> On Oct 5, 2011 1:26 AM, "Russell Keith-Magee" 
> wrote:
> > On Wed, Oct 5, 2011 at 7:42 AM, Cal Leeming [Simplicity Media Ltd]
> >  wrote:
> >> Argh - is anyone else from the list getting this same bounce mail all
> the
> >> time? I notified list admins but they couldnt find the relevant user. If
> you
> >> are getting this, PLEASE +1. Thanks. Cal
> >
> > Hi Cal,
> >
> > I found the user -- at least, I though I did -- and I thought I'd
> > disabled the sending of email to their account. Chalk this one up to a
> > Google Groups setting fail. I've now completely unsubscribed the user.
> > Let me know if you still see the problem.
> >
> > Yours,
> > Russ Magee %-)
> >
> >> -- Forwarded message --
> >> From: "Mail Delivery System" 
> >> Date: Oct 4, 2011 11:06 PM
> >> Subject: Undelivered Mail Returned to Sender
> >> To: 
> >>
> >> This is the mail system at host mail3.clocksoft.dom.
> >>
> >> I'm sorry to have to inform you that your message could not
> >> be delivered to one or more recipients. It's attached below.
> >>
> >> For further assistance, please send mail to postmaster.
> >>
> >> If you do so, please include this problem report. You can
> >> delete your own text from the attached returned message.
> >>
> >>   The mail system
> >>
> >> : mail transport unavailable
> >>
> >> Final-Recipient: rfc822; h...@clocksoft.com
> >> Original-Recipient: rfc822;h...@clocksoft.com
> >> Action: failed
> >> Status: 4.3.0
> >> Diagnostic-Code: X-Postfix; mail transport unavailable
> >>
> >>
> >> -- Forwarded message --
> >> From: "Cal Leeming [Simplicity Media Ltd]"
> >> 
> >> To: django-users@googlegroups.com
> >> Date: Thu, 29 Sep 2011 15:57:39 +0100
> >> Subject: (off-topic) Quick method of sending files from ssh to clients
> >> Hey,
> >> Little bit off topic, but quite relevant for the busy coder.
> >> Often I needed to quickly grab a file off a server, or send to a client,
> but
> >> it took me 2-3 minutes to fire up an SCP client, find the file, send it
> etc
> >> etc.
> >> So I created a small script (depends on sendmail and uuencode/sharutils)
> to
> >> send files via email:
> >>  foxx@sws01.internal [~] > cat /usr/sbin/sendfile
> >> #!/bin/sh
> >> if [ -z "$1" ] || [ -z "$2" ] || [ ! -f $1 ] ; then
> >> echo "syntax: [filename] [email address]"
> >> else
> >> (echo "file attached."; uuencode $1 $1) | mail -s "file attach: $1"
> $2
> >> echo "File sent to $2"
> >> fi
> >> Usage:
> >>  foxx@sws01.internal [~] > /usr/sbin/sendfile ~/lol
> >> cal.leem...@simplicitymedialtd.co.uk
> >> File sent to cal.leem...@simplicitymedialtd.co.uk
> >> Hopefully someone else will benefit from these 6 lines of code which
> saved
> >> me so much time :)
> >> Cal
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Django users" group.
> >> To post to this group, send email to django-users@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> django-users+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/django-users?hl=en.
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Django users" group.
> >> To post to this group, send email to django-users@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> django-users+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/django-users?hl=en.
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



encrypt and decrypt data in django.

2011-10-05 Thread Le Huu Nghia
Dear All,

i want to create a table to store information of user ,
That includes (username , password, ...)  this table must be diffrent
from admin table.
(ex some personal info so on)

can you give me an advice which lib of django to encrypt and decrypt , look
like the table admin of django.

Thanks a lot.
Nghia

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



setting site-name variable

2011-10-05 Thread ANU
1. Can one set "site-name" variable in __init__.py file? How?
2. Is there any method to set globally "site-name" variable so that in
the app, no further setting for this variable is needed?

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



Calling Jython from python script

2011-10-05 Thread Rohini Damle
Hello,
I am using python, mod-wsgi, django, apache combination. My views.py
script calls a set of python scripts. I also want to call some jython
scripts. For this I use cmd " jython script-name" . This works great
on django's development server. But on apache, with wsgi, the views.py
simply does not run that "cmd jython.." part.
Can anyone help me here? I added path to jython and path to java into
wsgi_handler.py script. But nothing helps.
Any suggestions/help is much appreciated.
Thank you
-Rohini

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



Using Django admin DateTime widget in my app

2011-10-05 Thread Sachin Gupta
Hello Everyone

I am totally new to Django and am finding it a fun experience to learn. 

Actually I need to make a form where I have to accept Date and Time for some 
sort of appointment. Django admin already has this widget. 
Will it be possible for me to use that directly? I read in an article that 
it is basically a hack and can cause problems if the widget is changed later 
on.

Is there any feature using which I can provide the calender widget and 
validate the Date Time field using some Django feature? Or I will have to 
use some 
other js calender widget?

Cheers
Sachin

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



retrieving data from Cache

2011-10-05 Thread himabindu
HI,

I have an issue in django framework. I was trying to develop a
progress bar for my application, where the progress depends on files
retrieved from the cache. But iam not able to retrieve the files from
the cache.


 CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.db',
'LOCATION': 'vmware/Downloads/Django-1.3/django/core/cache/
backends/',
   }
}



and i gave the statement as

 if progress_id:
from django.utils import simplejson
cache_key = "%s_%s" % (request.META['CACHES'], progress_id)
when a submit button is clicked the request is actually posted but the
progress is not shown.



Can anyone please help me out in solving the problem

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



Registering a model in the admin

2011-10-05 Thread Haffi
Hi, I'm registering a new model in the admin but it just won't show
up. I'm doing this in production, I added the model to models.py and
mirrored the changes in the DB. I registered it in admin.py just as
all the other models and restarted Apache but it won't show up and if
I try the URL it's supposed to be in I just get a permission denied
error. Any ideas?

-- 
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: retrieving data from Cache

2011-10-05 Thread Daniel Roseman
On Wednesday, 5 October 2011 09:51:11 UTC+1, himabindu wrote:
>
> HI, 
>
> I have an issue in django framework. I was trying to develop a 
> progress bar for my application, where the progress depends on files 
> retrieved from the cache. But iam not able to retrieve the files from 
> the cache. 
>
>
>  CACHES = { 
> 'default': { 
> 'BACKEND': 'django.core.cache.backends.db', 
> 'LOCATION': 'vmware/Downloads/Django-1.3/django/core/cache/ 
> backends/', 
>} 
> } 
>
 
This is obviously nonsense. Look again at the documentation for the db 
cache:
https://docs.djangoproject.com/en/1.3/topics/cache/#database-caching
and follow that.
--
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/-/FNgXYTuXrWEJ.
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: Two django apps (models) using same table

2011-10-05 Thread Konstantinos Pachnis
I believe you could also use proxy models in that case. Have a look at 
https://docs.djangoproject.com/en/1.3/topics/db/models/#proxy-models 

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



Combining Querysets from different, but similar models

2011-10-05 Thread Steven Smith
I'm working on a site that has a requirement for a "recent activity"
feed on the homepage. Usually, I'd just do a MyFoo.objects.order_by('-
created') and all would be well. But "activity" is actually from
several models. They all have some fields in common, like the
timestamp, since they all have the same abstract base class, but
they're definitely different things.

What's the cheapest way to do my queries and mix the results into one
feed? Ideally, the name of the model, or some other differentiating
attribute would be exposed so that I can use it in my template loop as
a style hook. Models in question are below...


class TrackableModel(models.Model):
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
created_by = models.ForeignKey(User, blank=True, null=True)
history = models.TextField(blank=True)
notes = models.TextField(blank=True)
is_active = models.BooleanField(blank=True, default=True)

class Meta:
abstract = True


class Review(TrackableModel):
book = models.ForeignKey('Textbook')
course = models.ForeignKey('TaughtCourse', blank=True, null=True)
should_buy = models.BooleanField(blank=True)
rating_prep = models.DecimalField(blank=True, null=True,
max_digits=2, decimal_places=1)
rating_hw = models.DecimalField(blank=True, null=True,
max_digits=2, decimal_places=1)
rating_inclass = models.DecimalField(blank=True, null=True,
max_digits=2, decimal_places=1)
can_share = models.BooleanField(blank=True, default=True)
comments = models.TextField(blank=True)


class MarketplacePosting(TrackableModel):
book = models.ForeignKey('Textbook', blank=True, null=True)
school = models.ForeignKey('School', blank=True, null=True)
location = models.CharField(max_length=255, blank=True,
verbose_name="Sale location")
condition = models.CharField(max_length=15, blank=True,
choices=CONDITION_CHOICES)
contains_highlighting = models.BooleanField(blank=True)
price = models.DecimalField(blank=True, null=True, max_digits=6,
decimal_places=2)
comments = models.TextField(blank=True)
is_sold = models.BooleanField(blank=True)

-- 
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: What is the right way to use S3 as a storage backend?

2011-10-05 Thread Shawn Milochik
Could it be the ADMIN_MEDIA_PREFIX setting?

-- 
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: What is the right way to use S3 as a storage backend?

2011-10-05 Thread Kurtis
I'll give that a shot. I pushed my bucket to the CDN and tried to set
that URL manually using:

STATIC_URL = 'http://kurtis.s3.amazonaws.com/'

Unfortunately, it's still trying to use /static/... Hopefully your
idea will work. Thanks!

On Oct 5, 9:54 am, Shawn Milochik  wrote:
> Could it be the ADMIN_MEDIA_PREFIX setting?

-- 
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: What is the right way to use S3 as a storage backend?

2011-10-05 Thread Kurtis
Okay, two things.

1. I saw I was potentionally using the wrong URL. I believe it should
be my CDN URL. Correct me if I'm wrong but the right URL *should* be
along the lines of: http://dw2u7t9lse636.cloudfront.net/

2. I included that ADMIN_MEDIA_PREFIX setting and it did update the
URLs for Admin media. Thanks!

Unfortunately, and this is probably an issue with Amazon -- I get a an
access denied error when I try to access my files. For example:

http://dw2u7t9lse636.cloudfront.net/css/base.css

On Oct 5, 10:01 am, Kurtis  wrote:
> I'll give that a shot. I pushed my bucket to the CDN and tried to set
> that URL manually using:
>
> STATIC_URL = 'http://kurtis.s3.amazonaws.com/'
>
> Unfortunately, it's still trying to use /static/... Hopefully your
> idea will work. Thanks!
>
> On Oct 5, 9:54 am, Shawn Milochik  wrote:
>
>
>
>
>
>
>
> > Could it be the ADMIN_MEDIA_PREFIX setting?

-- 
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: Thread-safeness of templates

2011-10-05 Thread Brian Bouterse
To add to your example.  Default arguments are parsed once by the
interpreter, not each time the program is run.  Most folks don't desire side
effects like this.  One way to avoid it is to only use immutable
typesin python as
keyword arguments (True, False, None, numbers, strings,
tuples).

Brian

On Tue, Oct 4, 2011 at 7:23 PM, Martin J. Laubach wrote:

>   Are you sure your context is thread-safe, ie. it's rebuilt from scratch
> every time you render an email and not re-used, stored in a global variable,
> class variable, whatever? Your problem description very much sounds like
> someone is fiddling with the context while the template is rendering.
>
>   A popular way to generate such a problem would be to use a literal dict
> as default parameter, something like:
>
> def my_render_email(recipient, context={}):
> context['email'] = recipient
> body = render_to_string('template.**html', context)
> ...
>
>   That is absolutely positively guaranteed to blow up in your face when you
> least expect it.
>
> mjl
>
>
>  --
> 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/-/mW012mKt7pwJ.
>
> 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.
>



-- 
Brian Bouterse
ITng Services

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



Question about Template

2011-10-05 Thread Tsung-Hsien
I want to put pictures on website and to let each row shows only four
pictures, but I write the template which shows each pictures in the
same row.
the loop within the , I think it should include  and add if
syntax to do that.
How to write the syntax?
thanks!

{% load static %}
{% get_static_prefix as STATIC_PREFIX %}



{% for photo in photos %}


{{photo.title}}

{% endfor %}



-- 
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: Question about Template

2011-10-05 Thread Tom Evans
On Wed, Oct 5, 2011 at 3:09 PM, Tsung-Hsien  wrote:
> I want to put pictures on website and to let each row shows only four
> pictures, but I write the template which shows each pictures in the
> same row.
> the loop within the , I think it should include  and add if
> syntax to do that.
> How to write the syntax?
> thanks!
>
> {% load static %}
> {% get_static_prefix as STATIC_PREFIX %}
>
> 
>        
>        {% for photo in photos %}
>                
>                         width="186"
> height="186" alt=""  />
>                        {{photo.title}}
>                
>        {% endfor %}
>        
> 
>

Within a for loop you have access to all sorts of counters:

https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#for

You can use these counters, and the divisibleby filter to work out
when you need to output a new row:

https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#divisibleby

So roughly:

{% for pic in pictures %}
{% if forloop.counter0|divisibleby:"4" %}{% endif %}
{{ pic }}
{% if forloop.counter0|divisibleby:"4" %}{% endif %}
{% endfor %}

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.



TimedThrottleFilter: Django logging filter to throttle logging

2011-10-05 Thread Michael Manfre
I recently encountered the problem of underlying IO issues triggering gigs
of repeated logs that were compounded by the extra logging. To help improve
the signal to noise ratio of the logs and prevent the downward spiral of IO
issues causing logging that cause more IO issues, I created a logging filter
to help reduce the repeated messages.

The basic design of the filter is to classify each message based upon a few
configurable criteria and then only allow a configurable number of repeated
messages in a given interval. The cache is used to track the frequency.

There were three specific logging cases I addressed with my approach. System
wide issues, a single point of failure, and user specific issues. The user
specific issues are mostly to address our GSA and other internal crawlers.
To catch system wide issues, logging messages are grouped by exception type
and repr(), if type is Exception. Single point of failure really means a
single logging call in the code. These are detected by logger name, function
name and line number. The filter can be configured (in settings) to ignore
specific logging statements to allow uncaught or common exception handlers
from being incorrectly grouped together. Specific user logging messages are
grouped if the filter can access the request.

Code and example LOGGING configuration can be found at
https://gist.github.com/1264432

Regards,
Michael Manfre

-- 
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: What is the right way to use S3 as a storage backend?

2011-10-05 Thread Kurtis
Okay I figured it out. Another slip of mind on my part :) I had to
change my CDN url to include '/admin/' since that's the subdirectory
my admin media is uploaded to.

On Oct 5, 10:07 am, Kurtis  wrote:
> Okay, two things.
>
> 1. I saw I was potentionally using the wrong URL. I believe it should
> be my CDN URL. Correct me if I'm wrong but the right URL *should* be
> along the lines of:http://dw2u7t9lse636.cloudfront.net/
>
> 2. I included that ADMIN_MEDIA_PREFIX setting and it did update the
> URLs for Admin media. Thanks!
>
> Unfortunately, and this is probably an issue with Amazon -- I get a an
> access denied error when I try to access my files. For example:
>
> http://dw2u7t9lse636.cloudfront.net/css/base.css
>
> On Oct 5, 10:01 am, Kurtis  wrote:
>
>
>
>
>
>
>
> > I'll give that a shot. I pushed my bucket to the CDN and tried to set
> > that URL manually using:
>
> > STATIC_URL = 'http://kurtis.s3.amazonaws.com/'
>
> > Unfortunately, it's still trying to use /static/... Hopefully your
> > idea will work. Thanks!
>
> > On Oct 5, 9:54 am, Shawn Milochik  wrote:
>
> > > Could it be the ADMIN_MEDIA_PREFIX setting?

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



TemplateView compatible with permission_required decorator?

2011-10-05 Thread Victor Hooi
Hi,

I'm attempting to use one of the new class-based TemplateView with the 
permission_required decorator:

@permission_required('foo.count_peas')
class Pea(TemplateView):
template_name = "pea.html"

However, when I do that, I get an error:

Exception Type: AttributeError at /someurl/
Exception Value: 'function' object has no attribute 'as_view'


If I comment out the permission_required decorator, the view seems to work 
fine.

Are the new class-based views compatible with the permission_required 
decorator?

Or is there something I need to do to make them work together.

Cheers,
Victor

-- 
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/-/BLrtdUAyciYJ.
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: What is the right way to use S3 as a storage backend?

2011-10-05 Thread creecode
Hello Kurtis,

On Wednesday, October 5, 2011 7:07:16 AM UTC-7, Kurtis wrote:
 

> Unfortunately, and this is probably an issue with Amazon -- I get a an 
> access denied error when I try to access my files. For example: 
>
> http://dw2u7t9lse636.cloudfront.net/css/base.css 


That response is most likely a setup issue with your permissions.  You need 
to make sure that everything along the path (bucket, folders, file) to your 
file has public access set for everyone to access via a browser.

Toodle-l
creecode

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



template designer needed

2011-10-05 Thread ApogeeGMail
Good Morning:

I am looking for a Django template designer for a very short project. I will 
need 5 pages, the design is done( using Photoshop).

I will need a set of templates to implement the layouts. I will provide the 
graphic elements.

Please contact me off list.

Thanks.

Richard Smith

mailto:apogeedevelopm...@gmail.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.



Simple input forms which show more than one row - easy/possible in django?

2011-10-05 Thread Chris G
I want to create a simple data entry form on a web page that shows all
the columns of a database across the page (there aren't many columns,
they will fit!) and a number of rows down the page.

I.e. I want a data entry form that looks like MS Access 'tabular'
format, as follows:-

Col1Row1Col2Row1Col3Row1Col4Row1Col5Row1
Col1Row2Col2Row2Col3Row2Col4Row2Col5Row2
Col1Row3Col2Row3Col3Row3Col4Row3Col5Row3
Col1Row4Col2Row4Col3Row4Col4Row4Col5Row4
Col1Row5Col2Row5Col3Row5Col4Row5Col5Row5
Col1Row6Col2Row6Col3Row6Col4Row6Col5Row6
New DataNew DataNew DataNew DataNew Data


Can django do this easily in a 'ready made' sort of way or do I have to
actually create the form and all its fields?

-- 
Chris Green

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



Permission_require decorator, and redirecting to Login Page

2011-10-05 Thread Victor Hooi
heya,

I'm using the permission-required decorator with the inbuilt login view.

When I login as a user who has the appropriate permissions, it logs in fine, 
and all is good.

When I try to login as a user with valid credentials but lacking the 
appropriate permission, it simply keeps redirecting to the login page again 
- but doesn't display any error message at all.

I tried adding "{{ form.non_field_errors }}" to the form but it still 
doesn't display any error messages.

Is there any way to get it to display that your user lacks the appropriate 
permissions, as opposed to just redirecting to a blank login page again and 
again.

Cheers,
Victor

-- 
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/-/alIHHeQMVb4J.
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: Combining Querysets from different, but similar models

2011-10-05 Thread Javier Guerra Giraldez
On Wed, Oct 5, 2011 at 8:37 AM, Steven Smith  wrote:
> What's the cheapest way to do my queries and mix the results into one
> feed?

I'd say to do it in Python.

a simpler case: you have two querysets and want a single 'feed' with
results of one query followed by the other:

from itertools import chain

reviews = Review.objects.filter()
postings = MarketplacePosting.objects.filter(...)

combined_feed = chain(reviews, postings)

simple, eh?  now a nicest addition would be to define an ordering for
each queryset on a similarly-named field and have the resultant
combination merges so the order is respected; something like this
(untested!):

def merge (fld, seqA, seqB):
iterA, iterB = iter(seqA), iter(seqB)
a, b = next(iterA), next(iterB)
while True:
if getattr(a,fld) <= getattr(b,fld):
yield a
try:
a = next(iterA)
except StopIteration:
while True:
yield next(iterB)
else:
yield b
b = next(iterB)
try:
b = next(iterB)
except StopIteration:
while True:
yield next(iterA)


-- 
Javier

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



Re: Simple input forms which show more than one row - easy/possible in django?

2011-10-05 Thread Brett Epps
Hi Chris,

Once you've defined a model for your data, you can use a ModelForm [1] to
automatically generate a form for that model.

You might also want to check out the admin site [2], which displays data
in a tabular format similar to what you describe.

1. https://docs.djangoproject.com/en/dev/topics/forms/modelforms/
2. https://docs.djangoproject.com/en/dev/ref/contrib/admin/

Brett


On 10/5/11 9:44 AM, "Chris G"  wrote:

>I want to create a simple data entry form on a web page that shows all
>the columns of a database across the page (there aren't many columns,
>they will fit!) and a number of rows down the page.
>
>I.e. I want a data entry form that looks like MS Access 'tabular'
>format, as follows:-
>
>Col1Row1Col2Row1Col3Row1Col4Row1Col5Row1
>Col1Row2Col2Row2Col3Row2Col4Row2Col5Row2
>Col1Row3Col2Row3Col3Row3Col4Row3Col5Row3
>Col1Row4Col2Row4Col3Row4Col4Row4Col5Row4
>Col1Row5Col2Row5Col3Row5Col4Row5Col5Row5
>Col1Row6Col2Row6Col3Row6Col4Row6Col5Row6
>New DataNew DataNew DataNew DataNew Data
>
>
>Can django do this easily in a 'ready made' sort of way or do I have to
>actually create the form and all its fields?
>
>-- 
>Chris Green
>
>-- 
>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: Simple input forms which show more than one row - easy/possible in django?

2011-10-05 Thread Daniel Roseman
On Wednesday, 5 October 2011 15:44:23 UTC+1, Chris Green wrote:
>
> I want to create a simple data entry form on a web page that shows all
> the columns of a database across the page (there aren't many columns,
> they will fit!) and a number of rows down the page.
>
> I.e. I want a data entry form that looks like MS Access 'tabular'
> format, as follows:-
>
> Col1Row1Col2Row1Col3Row1Col4Row1Col5Row1
> Col1Row2Col2Row2Col3Row2Col4Row2Col5Row2
> Col1Row3Col2Row3Col3Row3Col4Row3Col5Row3
> Col1Row4Col2Row4Col3Row4Col4Row4Col5Row4
> Col1Row5Col2Row5Col3Row5Col4Row5Col5Row5
> Col1Row6Col2Row6Col3Row6Col4Row6Col5Row6
> New DataNew DataNew DataNew DataNew Data
>
>
> Can django do this easily in a 'ready made' sort of way or do I have to
> actually create the form and all its fields?
>
> -- 
> Chris Green
>

You want model formsets:
https://docs.djangoproject.com/en/1.3/topics/forms/modelforms/#model-formsets

There's a third-party package called django-datagrid which might also help, 
but I've no idea what it's like.
https://github.com/agiliq/django-datagrid
--
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/-/RMiIsepmXq0J.
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: Combining Querysets from different, but similar models

2011-10-05 Thread Brett Epps
I had a similar need and solved it with a separate table of activity feed
items.  Here's the code for the Item model:

class Item(models.Model):

object_id = models.PositiveIntegerField(db_index=True)
content_type = models.ForeignKey(ContentType)
content_object = generic.GenericForeignKey('content_type', 'object_id')
...
[your common feed item fields go here]

Then I ensured that each model that could show up in the activity feed
added a new Item object in its save() method.  The result is that you can
pull the feed with one query, which could help a lot if you're mashing
together several models.  The downside is that you need to make sure the
items table stays in sync with the data from the models it is merging
together.


Brett


On 10/5/11 8:37 AM, "Steven Smith"  wrote:

>I'm working on a site that has a requirement for a "recent activity"
>feed on the homepage. Usually, I'd just do a MyFoo.objects.order_by('-
>created') and all would be well. But "activity" is actually from
>several models. They all have some fields in common, like the
>timestamp, since they all have the same abstract base class, but
>they're definitely different things.
>
>What's the cheapest way to do my queries and mix the results into one
>feed? Ideally, the name of the model, or some other differentiating
>attribute would be exposed so that I can use it in my template loop as
>a style hook. Models in question are below...
>
>
>class TrackableModel(models.Model):
>created = models.DateTimeField(auto_now_add=True)
>modified = models.DateTimeField(auto_now=True)
>created_by = models.ForeignKey(User, blank=True, null=True)
>history = models.TextField(blank=True)
>notes = models.TextField(blank=True)
>is_active = models.BooleanField(blank=True, default=True)
>
>class Meta:
>abstract = True
>
>
>class Review(TrackableModel):
>book = models.ForeignKey('Textbook')
>course = models.ForeignKey('TaughtCourse', blank=True, null=True)
>should_buy = models.BooleanField(blank=True)
>rating_prep = models.DecimalField(blank=True, null=True,
>max_digits=2, decimal_places=1)
>rating_hw = models.DecimalField(blank=True, null=True,
>max_digits=2, decimal_places=1)
>rating_inclass = models.DecimalField(blank=True, null=True,
>max_digits=2, decimal_places=1)
>can_share = models.BooleanField(blank=True, default=True)
>comments = models.TextField(blank=True)
>
>
>class MarketplacePosting(TrackableModel):
>book = models.ForeignKey('Textbook', blank=True, null=True)
>school = models.ForeignKey('School', blank=True, null=True)
>location = models.CharField(max_length=255, blank=True,
>verbose_name="Sale location")
>condition = models.CharField(max_length=15, blank=True,
>choices=CONDITION_CHOICES)
>contains_highlighting = models.BooleanField(blank=True)
>price = models.DecimalField(blank=True, null=True, max_digits=6,
>decimal_places=2)
>comments = models.TextField(blank=True)
>is_sold = models.BooleanField(blank=True)
>
>-- 
>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: Registering a model in the admin

2011-10-05 Thread Brett Epps
Could you show us the contents of your admin.py file?  Did you remember to
call admin.site.register(ModelClass, ModelClassAdmin) for that model?

Brett


On 10/5/11 6:09 AM, "Haffi"  wrote:

>Hi, I'm registering a new model in the admin but it just won't show
>up. I'm doing this in production, I added the model to models.py and
>mirrored the changes in the DB. I registered it in admin.py just as
>all the other models and restarted Apache but it won't show up and if
>I try the URL it's supposed to be in I just get a permission denied
>error. Any ideas?
>
>-- 
>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.



Alternative to Decorators for Class-Based View

2011-10-05 Thread Kurtis
Hey,

What's the best way to go about doing things for class-based views
such as requiring logins? In the function-based views it was easy to
use decorators.

Should I just replace the functionality that I would previously have
put into decorators into abstract classes that I extend? If so, can
someone throw me a simple example?

Not only do I want to have some views require a user to be logged in,
but I'd like to have other pages require a user to have an active paid
membership, and so forth ... If there's a better approach to this, let
me know.

Thanks in advanced!

-- 
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: encrypt and decrypt data in django.

2011-10-05 Thread Brett Epps
Hi Nghia,

The common pattern is to extend django.contrib.auth.models.User by creating 
your own "profile" model with the fields you need [1].  Then you can set the 
AUTH_PROFILE_MODULE setting and access the profile from User objects through 
the User.get_profile method.  The Python standard library has modules related 
to encryption [2].

  1.  
https://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users
  2.  http://docs.python.org/library/crypto.html

Hope that helps,

Brett

From: Le Huu Nghia mailto:lehuunghi...@gmail.com>>
Reply-To: mailto:django-users@googlegroups.com>>
Date: Wed, 5 Oct 2011 19:34:39 +0800
To: mailto:django-users@googlegroups.com>>
Subject: encrypt and decrypt data in django.

Dear All,

i want to create a table to store information of user ,
That includes (username , password, ...)  this table must be diffrent from 
admin table.
(ex some personal info so on)

can you give me an advice which lib of django to encrypt and decrypt , look 
like the table admin of django.

Thanks a lot.
Nghia


--
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: effective adding records in Django site admin

2011-10-05 Thread shacker
If you want the ability to make copies of multiple records at once, or just 
want the "copy" option to appear at the top of the object list instead of 
having to click through into each record, it's pretty easy to set up an 
Admin Action. Here's one I use in a system that lets staffers duplicate 
Course records from one semester to another.  In admin.py:

# Custom Admin Action enables making a complete copy of a course (like a 
Save As...)
def make_copy(modeladmin, request, queryset):
for obj in queryset:
# Make a copy in memory
# Override the ID so the db can auto_increment -- otherwise we 
overwrite the original!
# Update the title of the new object
n = obj
n.id = None
n.title = "NEW COPY OF: " + obj.title 
n.save()
request.user.message_set.create(message="Selected courses have been 
copied. Remember to set their Instructors and Programs!")
make_copy.short_description = "Make copies of selected courses"

.


class CourseAdmin(admin.ModelAdmin):
list_display = ('jstring','title', 'ccn', 'semester')
search_fields = ('title','jstring__name')
actions = [make_copy]
form = CourseAdminForm

-- 
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/-/S-U4L-TOnn0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: setting site-name variable

2011-10-05 Thread Brett Epps
Which "site-name" variable are you referring to?  Usually you'll want to
place global settings in your settings.py file.  Then you can access them
elsewhere like this:

from django.conf import settings
print settings.[name of setting]

Also, you might be interested in the sites framework [1], which is useful
for running multiple websites using the same Django project.

1. https://docs.djangoproject.com/en/dev/ref/contrib/sites/

Brett


On 10/5/11 12:14 AM, "ANU"  wrote:

>1. Can one set "site-name" variable in __init__.py file? How?
>2. Is there any method to set globally "site-name" variable so that in
>the app, no further setting for this variable is needed?
>
>-- 
>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: template designer needed

2011-10-05 Thread David Koblas

Have you considered 99designs?

--david

On 10/5/11 7:38 AM, ApogeeGMail wrote:

Good Morning:

I am looking for a Django template designer for a very short project. 
I will need 5 pages, the design is done( using Photoshop).


I will need a set of templates to implement the layouts. I will 
provide the graphic elements.


Please contact me off list.

Thanks.

Richard Smith

mailto:apogeedevelopm...@gmail.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.


--
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: Simple input forms which show more than one row - easy/possible in django?

2011-10-05 Thread Chris G
On Wed, Oct 05, 2011 at 03:13:08PM +, Brett Epps wrote:
> Hi Chris,
> 
> Once you've defined a model for your data, you can use a ModelForm [1] to
> automatically generate a form for that model.
> 
> You might also want to check out the admin site [2], which displays data
> in a tabular format similar to what you describe.
> 
Yes, I'd seen that, can I get the admin forms to work 'outside' as it
were? 

> 1. https://docs.djangoproject.com/en/dev/topics/forms/modelforms/
> 2. https://docs.djangoproject.com/en/dev/ref/contrib/admin/
> 
Thanks, it looks as if ModelForm will do most of what I want.

-- 
Chris Green

-- 
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: template designer needed

2011-10-05 Thread ApogeeGMail
David:

I did not. I did just look at the site.

I am not sure this would work. I already have a design, which the team has 
approved. I just need the templates for DJango.

Richard

On Oct 5, 2011, at 11:44 AM, David Koblas wrote:

> Have you considered 99designs?
> 
> --david
> 
> On 10/5/11 7:38 AM, ApogeeGMail wrote:
>> Good Morning:
>> 
>> I am looking for a Django template designer for a very short project. I will 
>> need 5 pages, the design is done( using Photoshop).
>> 
>> I will need a set of templates to implement the layouts. I will provide the 
>> graphic elements.
>> 
>> Please contact me off list.
>> 
>> Thanks.
>> 
>> Richard Smith
>> 
>> mailto:apogeedevelopm...@gmail.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.
> 
> -- 
> 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: template designer needed

2011-10-05 Thread NISA BALAKRISHNAN
david:

send me the design. r u checking someone for slicing psd to html or is it
just to design the template structure- the division of base templates and
their inheritance for the ones that extend.

On Wed, Oct 5, 2011 at 9:43 PM, ApogeeGMail wrote:

> David:
>
> I did not. I did just look at the site.
>
> I am not sure this would work. I already have a design, which the team has
> approved. I just need the templates for DJango.
>
> Richard
>
> On Oct 5, 2011, at 11:44 AM, David Koblas wrote:
>
> > Have you considered 99designs?
> >
> > --david
> >
> > On 10/5/11 7:38 AM, ApogeeGMail wrote:
> >> Good Morning:
> >>
> >> I am looking for a Django template designer for a very short project. I
> will need 5 pages, the design is done( using Photoshop).
> >>
> >> I will need a set of templates to implement the layouts. I will provide
> the graphic elements.
> >>
> >> Please contact me off list.
> >>
> >> Thanks.
> >>
> >> Richard Smith
> >>
> >> mailto:apogeedevelopm...@gmail.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.
> >
> > --
> > 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.
>
>


-- 
Thanks & Regards,

Nisa Balakrishnan,
SHARJAH, UAE.

-- 
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: Simple input forms which show more than one row - easy/possible in django?

2011-10-05 Thread Andre Terra
I've only skimmed this thread, but I recommend django-form-utils[1] if what
you want is to write nicely formatted forms with little to no headache at
all.

[1] https://bitbucket.org/carljm/django-form-utils/overview


Cheers,
AT

On Wed, Oct 5, 2011 at 1:05 PM, Chris G  wrote:

> On Wed, Oct 05, 2011 at 03:13:08PM +, Brett Epps wrote:
> > Hi Chris,
> >
> > Once you've defined a model for your data, you can use a ModelForm [1] to
> > automatically generate a form for that model.
> >
> > You might also want to check out the admin site [2], which displays data
> > in a tabular format similar to what you describe.
> >
> Yes, I'd seen that, can I get the admin forms to work 'outside' as it
> were?
>
> > 1. https://docs.djangoproject.com/en/dev/topics/forms/modelforms/
> > 2. https://docs.djangoproject.com/en/dev/ref/contrib/admin/
> >
> Thanks, it looks as if ModelForm will do most of what I want.
>
> --
> Chris Green
>
> --
> 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: Randomly clearing database tables

2011-10-05 Thread Ian Kelly
On Tue, Oct 4, 2011 at 2:28 PM, msbuck  wrote:
> Below is the settings. I am fairly new to python unit testing so my
> understanding of things could be better. But right now, if I select
> Run As -> Python Unit Test will my project is selected, it runs all of
> my Django tests and clobbers my working db as a result. The test
> runner also appears to be ignoring my @skipUnless decorators that
> should prevent db tests from running if settings.IS_TEST is set to
> False. I'm getting frustrated again!

I haven't used PyDev, but I would imagine it's probably importing the
management commands and running them programmatically, rather than
simply trying to run manage.py.  That would explain why your IS_TEST
is False.  According to the docs, PyDev has a DJANGO_SETTINGS_MODULE
variable.  I suggest setting that to an alternate settings.py that
contains your test settings.

I still can't see any reason why the tests would be flushing your
tables, though.  Does it happen when you issue manage.py test (using
the oracle backend) as well, or only from PyDev?  Could there be
something in your app tests that might be causing the flush?

-- 
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: Alternative to Decorators for Class-Based View

2011-10-05 Thread Dan Gentry
In the docs there a paragraph or two about this.  Basically, one must
decorate the dispatch method instead.  See this link for the details.

https://docs.djangoproject.com/en/dev/topics/class-based-views/#decorating-the-class

Good luck!

On Oct 5, 11:42 am, Kurtis  wrote:
> Hey,
>
> What's the best way to go about doing things for class-based views
> such as requiring logins? In the function-based views it was easy to
> use decorators.
>
> Should I just replace the functionality that I would previously have
> put into decorators into abstract classes that I extend? If so, can
> someone throw me a simple example?
>
> Not only do I want to have some views require a user to be logged in,
> but I'd like to have other pages require a user to have an active paid
> membership, and so forth ... If there's a better approach to this, let
> me know.
>
> Thanks in advanced!

-- 
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: TemplateView compatible with permission_required decorator?

2011-10-05 Thread Dan Gentry
Instead, you should decorate the dispatch method in the class-based
view.  See the docs here:

https://docs.djangoproject.com/en/dev/topics/class-based-views/#decorating-the-class



On Oct 5, 10:27 am, Victor Hooi  wrote:
> Hi,
>
> I'm attempting to use one of the new class-based TemplateView with the
> permission_required decorator:
>
> @permission_required('foo.count_peas')
> class Pea(TemplateView):
>     template_name = "pea.html"
>
> However, when I do that, I get an error:
>
> Exception Type: AttributeError at /someurl/
> Exception Value: 'function' object has no attribute 'as_view'
>
> If I comment out the permission_required decorator, the view seems to work
> fine.
>
> Are the new class-based views compatible with the permission_required
> decorator?
>
> Or is there something I need to do to make them work together.
>
> Cheers,
> Victor

-- 
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: What is the right way to use S3 as a storage backend?

2011-10-05 Thread Andre Terra
I may be dreaming, but IIRC ADMIN_MEDIA_PREFIX is on its way to deprecation,
so some googling might be in order.

Cheers,
AT


On Wed, Oct 5, 2011 at 11:07 AM, Kurtis  wrote:

> Okay, two things.
>
> 1. I saw I was potentionally using the wrong URL. I believe it should
> be my CDN URL. Correct me if I'm wrong but the right URL *should* be
> along the lines of: http://dw2u7t9lse636.cloudfront.net/
>
> 2. I included that ADMIN_MEDIA_PREFIX setting and it did update the
> URLs for Admin media. Thanks!
>
> Unfortunately, and this is probably an issue with Amazon -- I get a an
> access denied error when I try to access my files. For example:
>
> http://dw2u7t9lse636.cloudfront.net/css/base.css
>
> On Oct 5, 10:01 am, Kurtis  wrote:
> > I'll give that a shot. I pushed my bucket to the CDN and tried to set
> > that URL manually using:
> >
> > STATIC_URL = 'http://kurtis.s3.amazonaws.com/'
> >
> > Unfortunately, it's still trying to use /static/... Hopefully your
> > idea will work. Thanks!
> >
> > On Oct 5, 9:54 am, Shawn Milochik  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Could it be the ADMIN_MEDIA_PREFIX setting?
>
> --
> 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: What is the right way to use S3 as a storage backend?

2011-10-05 Thread Micky Hulse
Not sure if this will be of any help, but I switched from
django-storages to this:



I switched mostly because SORL was not working well with my S3
buckets... CuddlyBuddly has this:



Not sure if CuddlyBuddly has more features... I have been very satisfied.

Anyway, just FYI.

-- 
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: Calling Jython from python script

2011-10-05 Thread Bill Freeman
Have you tried using the full path for both jython and for the script?

Does jython also need classpath set up?

Maybe you should provide the full path to a shell script that sets up
the path, the class path and cd's to where the script is, then does:

  jython script-name

Are you sure that you want the server waiting around until this
script finishes?

Bill

On Wed, Oct 5, 2011 at 2:13 AM, Rohini Damle  wrote:
> Hello,
> I am using python, mod-wsgi, django, apache combination. My views.py
> script calls a set of python scripts. I also want to call some jython
> scripts. For this I use cmd " jython script-name" . This works great
> on django's development server. But on apache, with wsgi, the views.py
> simply does not run that "cmd jython.." part.
> Can anyone help me here? I added path to jython and path to java into
> wsgi_handler.py script. But nothing helps.
> Any suggestions/help is much appreciated.
> Thank you
> -Rohini
>
> --
> 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: Calling Jython from python script

2011-10-05 Thread Charles Cossé
Doubt I can be much help, but are you running via os.system("jythong ...")?
 If so, then I'd substitute something else (python itself?) for jython and
confirm that that much works .. then carry on ...
-Charles

On Wed, Oct 5, 2011 at 12:54 PM, Bill Freeman  wrote:

> Have you tried using the full path for both jython and for the script?
>
> Does jython also need classpath set up?
>
> Maybe you should provide the full path to a shell script that sets up
> the path, the class path and cd's to where the script is, then does:
>
>  jython script-name
>
> Are you sure that you want the server waiting around until this
> script finishes?
>
> Bill
>
> On Wed, Oct 5, 2011 at 2:13 AM, Rohini Damle 
> wrote:
> > Hello,
> > I am using python, mod-wsgi, django, apache combination. My views.py
> > script calls a set of python scripts. I also want to call some jython
> > scripts. For this I use cmd " jython script-name" . This works great
> > on django's development server. But on apache, with wsgi, the views.py
> > simply does not run that "cmd jython.." part.
> > Can anyone help me here? I added path to jython and path to java into
> > wsgi_handler.py script. But nothing helps.
> > Any suggestions/help is much appreciated.
> > Thank you
> > -Rohini
> >
> > --
> > 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.



Beginner a bit lost - need some pointers please

2011-10-05 Thread Chris G
I'm an experienced programmer (started around 1971 or so!) and I've done
lots of things over the years, much of my background is in Unix (Solaris).
In the last few years I have done quite a lot of web related stuff.

I'm trying to get my mind round django.  I have it installed on my
unbuntu server, it works, I've worked through tutorials 1 and 2 and a
bit of 3.  I can get the admin screens up and the basics of the polls
example work.

However two rather basic things still elude me:-

Where/how do I actually start creating the top level/page of a web
site?   Do I just open vi and create some HTML and embed django
code?  That seems unlikely but I can't see anywhere that tells me
what the code that creates a django site looks like and/or where it
resides.   An actual example of a two or three page working django
based web site would be a huge help.

I can't see anywhere that seems to tell me the issues involved with
moving from using the built in web server to using apache2 (or
whatever, I have apache2 on my system).

I know that in a few days time when I have got over the initial hump all
the above will seem trivial so sorry to ask, but at the moment I'm
feeling a bit lost!  :-)

-- 
Chris Green

-- 
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: Beginner a bit lost - need some pointers please

2011-10-05 Thread Cal Leeming [Simplicity Media Ltd]
Hi Chris,

I'm assuming that you don't have any experience with Python??

Also - have you read the intro overview, as that pretty much answers your
questions, unless I'm missing something

https://docs.djangoproject.com/en/1.3/intro/overview/

Cal

On Wed, Oct 5, 2011 at 8:55 PM, Chris G  wrote:

> I'm an experienced programmer (started around 1971 or so!) and I've done
> lots of things over the years, much of my background is in Unix (Solaris).
> In the last few years I have done quite a lot of web related stuff.
>
> I'm trying to get my mind round django.  I have it installed on my
> unbuntu server, it works, I've worked through tutorials 1 and 2 and a
> bit of 3.  I can get the admin screens up and the basics of the polls
> example work.
>
> However two rather basic things still elude me:-
>
>Where/how do I actually start creating the top level/page of a web
>site?   Do I just open vi and create some HTML and embed django
>code?  That seems unlikely but I can't see anywhere that tells me
>what the code that creates a django site looks like and/or where it
>resides.   An actual example of a two or three page working django
>based web site would be a huge help.
>
>I can't see anywhere that seems to tell me the issues involved with
>moving from using the built in web server to using apache2 (or
>whatever, I have apache2 on my system).
>
> I know that in a few days time when I have got over the initial hump all
> the above will seem trivial so sorry to ask, but at the moment I'm
> feeling a bit lost!  :-)
>
> --
> Chris Green
>
> --
> 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: encrypt and decrypt data in django.

2011-10-05 Thread arapaho
The docs say to set up a table with a one-to-one relationship to the
admin user table

On Oct 5, 7:34 am, Le Huu Nghia  wrote:
> Dear All,
>
> i want to create a table to store information of user ,
> That includes (username , password, ...)  this table must be diffrent
> from admin table.
> (ex some personal info so on)
>
> can you give me an advice which lib of django to encrypt and decrypt , look
> like the table admin of django.
>
> Thanks a lot.
> Nghia

-- 
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: Beginner a bit lost - need some pointers please

2011-10-05 Thread Yaşar Arabacı
This documentation goes over deployment of django:
https://docs.djangoproject.com/en/1.3/howto/deployment/

2011/10/5 Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk>

> Hi Chris,
>
> I'm assuming that you don't have any experience with Python??
>
> Also - have you read the intro overview, as that pretty much answers your
> questions, unless I'm missing something
>
> https://docs.djangoproject.com/en/1.3/intro/overview/
>
> Cal
>
>
> On Wed, Oct 5, 2011 at 8:55 PM, Chris G  wrote:
>
>> I'm an experienced programmer (started around 1971 or so!) and I've done
>> lots of things over the years, much of my background is in Unix (Solaris).
>> In the last few years I have done quite a lot of web related stuff.
>>
>> I'm trying to get my mind round django.  I have it installed on my
>> unbuntu server, it works, I've worked through tutorials 1 and 2 and a
>> bit of 3.  I can get the admin screens up and the basics of the polls
>> example work.
>>
>> However two rather basic things still elude me:-
>>
>>Where/how do I actually start creating the top level/page of a web
>>site?   Do I just open vi and create some HTML and embed django
>>code?  That seems unlikely but I can't see anywhere that tells me
>>what the code that creates a django site looks like and/or where it
>>resides.   An actual example of a two or three page working django
>>based web site would be a huge help.
>>
>>I can't see anywhere that seems to tell me the issues involved with
>>moving from using the built in web server to using apache2 (or
>>whatever, I have apache2 on my system).
>>
>> I know that in a few days time when I have got over the initial hump all
>> the above will seem trivial so sorry to ask, but at the moment I'm
>> feeling a bit lost!  :-)
>>
>> --
>> Chris Green
>>
>> --
>> 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.
>



-- 
http://yasar.serveblog.net/

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



Re: Beginner a bit lost - need some pointers please

2011-10-05 Thread Javier Guerra Giraldez
On Wed, Oct 5, 2011 at 2:55 PM, Chris G  wrote:
> I'm trying to get my mind round django.  I have it installed on my
> unbuntu server, it works, I've worked through tutorials 1 and 2 and a
> bit of 3.  I can get the admin screens up and the basics of the polls
> example work.

just finish the tutorial.  seriously, even if you're so experienced,
it's a much needed introduction.

about how to write, check the paragraph about the MTV architecture:
model, view template.  in short, that means: write your models with
most of the conceptual functionality; then write a view that gathers
all needed info from the models and calls a template to show it as a
web page.  templates should have very minimal 'code' embedded, just to
display the data gathered by the view.

but please, do the tutorial.

-- 
Javier

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



Re: Beginner a bit lost - need some pointers please

2011-10-05 Thread Ivan Ivanov
На Wed, 5 Oct 2011 15:02:13 -0500
Javier Guerra Giraldez  написа:

> about how to write, check the paragraph about the MTV architecture:

If you are familier with MVC (Model, View, Controller), MTV is the same
but with different component names.

-- 
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: Beginner a bit lost - need some pointers please

2011-10-05 Thread Javier Guerra Giraldez
On Wed, Oct 5, 2011 at 3:20 PM, Ivan Ivanov  wrote:
>> about how to write, check the paragraph about the MTV architecture:
>
> If you are familier with MVC (Model, View, Controller), MTV is the same
> but with different component names.

sorry, but no.

a Django view is way different from an MVC view, there's nothing like
controller in django (fortunately, that's a GUI concept, not a web
thing; and no, urls.py is not a controller), MVC doesn't separate view
from template like Django does, and lots more

-- 
Javier

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



Re: Beginner a bit lost - need some pointers please

2011-10-05 Thread Peter Herndon

On Oct 5, 2011, at 3:55 PM, Chris G wrote:
> 
> However two rather basic things still elude me:-
> 
>Where/how do I actually start creating the top level/page of a web
>site?   Do I just open vi and create some HTML and embed django
>code?  That seems unlikely but I can't see anywhere that tells me
>what the code that creates a django site looks like and/or where it
>resides.   An actual example of a two or three page working django
>based web site would be a huge help.

I've seen a few different patterns in regards to this question. One scenario is 
where you have a multi-purpose Django site comprised of multiple reusable apps 
with no obvious top-level entry point, you can create a view "def 
index(request)", and have it render a template with whatever data you want to 
send it -- including perhaps no data at all. Then map your index view to '/' in 
urls.py at the project level, put together a template and you're all set.

Another option I've seen is if you have a single-purpose site where one app is 
primary, you map your primary app's start page as your index. An example would 
be a blog, and you would set up your chronological entries list page as the 
index.


> 
>I can't see anywhere that seems to tell me the issues involved with
>moving from using the built in web server to using apache2 (or
>whatever, I have apache2 on my system).

The short version is that the built-in server was built as a 
just-good-enough-to-use-while-developing solution, and is not sufficient to 
handle more than a minimal load. The trade-off is that configuring apache2 + 
mod_wsgi, or nginx + gunicorn, is more complex than just running the devserver.

Hope this helps a bit,

---Peter Herndon

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



Tizicjxzajhkztxz

2011-10-05 Thread Simone Dalla
U


--

Simone Dalla
Responsabile Servizi Informatici
Comune di Zola Predosa
tel. 0516161662
cel. 3290179546
email: sda...@comune.zolapredosa.bo.it
skype: simone.dalla

-- 
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: Beginner a bit lost - need some pointers please

2011-10-05 Thread Chris G
On Wed, Oct 05, 2011 at 08:58:10PM +0100, Cal Leeming [Simplicity Media Ltd] 
wrote:
>Hi Chris,
>I'm assuming that you don't have any experience with Python??

No/yes, I *do* have Python experience, it's my language of choice for
scripts which require a bit more than basic shell scripting.


>Also - have you read the intro overview, as that pretty much answers your
>questions, unless I'm missing something
>[1]https://docs.djangoproject.com/en/1.3/intro/overview/
>Cal
> 
I've looked at that, but maybe not hard enough.  A quick glance seems to
raise some of the same questions, there are lots of code snippets in
there but it's not *very* clear where they all live or even whether one
has to write them or they're generated by django.  It does seem a bit
clearer at a second reading though so I suspect it will all become clear
eventually. 

-- 
Chris Green

-- 
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: Beginner a bit lost - need some pointers please

2011-10-05 Thread Chris G
On Wed, Oct 05, 2011 at 11:02:03PM +0300, Yaşar Arabacı wrote:
>This documentation goes over deployment of
>django: [1]https://docs.djangoproject.com/en/1.3/howto/deployment/
> 
Ah, brilliant, thanks, that certainly answers my question about how to
use it with apache.

-- 
Chris Green

-- 
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: Beginner a bit lost - need some pointers please

2011-10-05 Thread Chris G
On Wed, Oct 05, 2011 at 03:02:13PM -0500, Javier Guerra Giraldez wrote:
> On Wed, Oct 5, 2011 at 2:55 PM, Chris G  wrote:
> > I'm trying to get my mind round django.  I have it installed on my
> > unbuntu server, it works, I've worked through tutorials 1 and 2 and a
> > bit of 3.  I can get the admin screens up and the basics of the polls
> > example work.
> 
> just finish the tutorial.  seriously, even if you're so experienced,
> it's a much needed introduction.
> 
> about how to write, check the paragraph about the MTV architecture:
> model, view template.  in short, that means: write your models with
> most of the conceptual functionality; then write a view that gathers
> all needed info from the models and calls a template to show it as a
> web page.  templates should have very minimal 'code' embedded, just to
> display the data gathered by the view.
> 
> but please, do the tutorial.
> 
OK, I'll work through the rest of it, thanks.

-- 
Chris Green

-- 
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: Beginner a bit lost - need some pointers please

2011-10-05 Thread Chris G
On Wed, Oct 05, 2011 at 04:35:49PM -0400, Peter Herndon wrote:
> 
> On Oct 5, 2011, at 3:55 PM, Chris G wrote:
> > 
> > However two rather basic things still elude me:-
> > 
> >Where/how do I actually start creating the top level/page of a web
> >site?   Do I just open vi and create some HTML and embed django
> >code?  That seems unlikely but I can't see anywhere that tells me
> >what the code that creates a django site looks like and/or where it
> >resides.   An actual example of a two or three page working django
> >based web site would be a huge help.
> 
> I've seen a few different patterns in regards to this question. One scenario 
> is where you have a multi-purpose Django site comprised of multiple reusable 
> apps with no obvious top-level entry point, you can create a view "def 
> index(request)", and have it render a template with whatever data you want to 
> send it -- including perhaps no data at all. Then map your index view to '/' 
> in urls.py at the project level, put together a template and you're all set.
> 
> Another option I've seen is if you have a single-purpose site where one app 
> is primary, you map your primary app's start page as your index. An example 
> would be a blog, and you would set up your chronological entries list page as 
> the index.
> 
OK, so there isn't a single simple answer.  However it would still be
really nice to see a complete two or three page django site with a
database behind it fully implemented as an example.

> 
> > 
> >I can't see anywhere that seems to tell me the issues involved with
> >moving from using the built in web server to using apache2 (or
> >whatever, I have apache2 on my system).
> 
> The short version is that the built-in server was built as a 
> just-good-enough-to-use-while-developing solution, and is not sufficient to 
> handle more than a minimal load. The trade-off is that configuring apache2 + 
> mod_wsgi, or nginx + gunicorn, is more complex than just running the 
> devserver.
> 
Sorry, I maybe didn't explain well what I wanted.  I realise that
configuring apache2 to do all this involves more work, what I wanted was
the steps required to go from a working django project under the
built-in server to one that works under apache2.

Someone else has pointed me at 
https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/
though which seems to be what I need.

-- 
Chris Green

-- 
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: Beginner a bit lost - need some pointers please

2011-10-05 Thread Kurtis Mullins
I just wanted to put my 2 cents in. #django on Freenode is a great place to get 
real-time help with simple questions.


On Oct 5, 2011, at 6:02 PM, Chris G wrote:

> On Wed, Oct 05, 2011 at 04:35:49PM -0400, Peter Herndon wrote:
>> 
>> On Oct 5, 2011, at 3:55 PM, Chris G wrote:
>>> 
>>> However two rather basic things still elude me:-
>>> 
>>>   Where/how do I actually start creating the top level/page of a web
>>>   site?   Do I just open vi and create some HTML and embed django
>>>   code?  That seems unlikely but I can't see anywhere that tells me
>>>   what the code that creates a django site looks like and/or where it
>>>   resides.   An actual example of a two or three page working django
>>>   based web site would be a huge help.
>> 
>> I've seen a few different patterns in regards to this question. One scenario 
>> is where you have a multi-purpose Django site comprised of multiple reusable 
>> apps with no obvious top-level entry point, you can create a view "def 
>> index(request)", and have it render a template with whatever data you want 
>> to send it -- including perhaps no data at all. Then map your index view to 
>> '/' in urls.py at the project level, put together a template and you're all 
>> set.
>> 
>> Another option I've seen is if you have a single-purpose site where one app 
>> is primary, you map your primary app's start page as your index. An example 
>> would be a blog, and you would set up your chronological entries list page 
>> as the index.
>> 
> OK, so there isn't a single simple answer.  However it would still be
> really nice to see a complete two or three page django site with a
> database behind it fully implemented as an example.
> 
>> 
>>> 
>>>   I can't see anywhere that seems to tell me the issues involved with
>>>   moving from using the built in web server to using apache2 (or
>>>   whatever, I have apache2 on my system).
>> 
>> The short version is that the built-in server was built as a 
>> just-good-enough-to-use-while-developing solution, and is not sufficient to 
>> handle more than a minimal load. The trade-off is that configuring apache2 + 
>> mod_wsgi, or nginx + gunicorn, is more complex than just running the 
>> devserver.
>> 
> Sorry, I maybe didn't explain well what I wanted.  I realise that
> configuring apache2 to do all this involves more work, what I wanted was
> the steps required to go from a working django project under the
> built-in server to one that works under apache2.
> 
> Someone else has pointed me at 
> https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/
> though which seems to be what I need.
> 
> -- 
> Chris Green
> 
> -- 
> 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] django.views.generic.TemplateView example

2011-10-05 Thread Micky Hulse
Ack! Russ, I missed this e-mail! I am so sorry for the late reply!

Thanks so much for helping me out, I really appreciate it. :)

On Fri, Sep 30, 2011 at 9:08 PM, Russell Keith-Magee
 wrote:
> There's no need to subclass TemplateView and provide your own implementation
> of get_context_data() - the default TemplateView implementation does exactly
> (and I mean character-for-character exactly) what you've defined. So, you
> just need to deploy a default TemplateView in your urls.py:

Hehe! Thanks so much for pointing that out! I should have visited the
source code before posting my question. :(

It's funny, I was just going to reply to the list with my latest
solution... Long story short, my co-worker shared this code:

urlpatterns = patterns('',
   (r'^phone-list/$', ListView.as_view(
   queryset=Staffer.objects.filter(active=True).order_by('last_name'),
   )),
)

... and that motivated me to read the source code [1] and write this
in my urls.py:

from django.views import generic
...
(r'^(?P[a-zA-Z0-9]{32})/$', generic.TemplateView.as_view(
template_name='wire/feed.html',
)),
...

Exactly what you suggested that I do!

That's great though. Thank you for taking the time to help me out, I
really appreciate it. :)

> I know the class-based views docs aren't as good as they could be - thats
> mostly my fault. I also know that "read the source" isn't a real
> documentation answer. However, the CBV code is quite well documented
> internally, and isn't all that complex at the end of the day - if you've got
> questions about how to do something obscure with CBVs, a quick peruse of the
> source is well worth your time.

That works for me! Like I said above, I should have read the source
code before bugging the group. It's amazing how clear things can be
when reading the Django source code.

>From now on, I will be sure to go to the code before asking questions. :D

Thanks again! Have an awesome day.

[1] 
https://code.djangoproject.com/browser/django/trunk/django/views/generic/base.py#L114

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



Earn 25$ to add Email Notification support to Django-Userena

2011-10-05 Thread Rich Jones
Hey all!

I've opened a 25$ gig on Gun.io to add Email Notification support to
Django-Userena. First person to get a pull request accepted will earn
the money!

http://gun.io/open/11/add-email-notifcations-to-django-userena-umessages

Thought you guys might be interested in earning a quick bit of money
to work on an open source project.

Rich

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



@transaction.commit_on_success, not getting expected results

2011-10-05 Thread robinne
Based on Django 1.3 documentation for transactions, it seems you can
have all or nothing updates of database calls within a view. I am not
getting the expected behavior and it seems there must be an
"autocommit" global setting somewhere that I need to set to false.
Does anyone know of such a setting? Here is sample code, I would
expect no updates to my "Credit" table, yet I get one new row.

@transaction.commit_on_success
def Test(request):
try:
member = request.user.get_profile()
Credit.objects.create(CreditDate=datetime.datetime.now(),
Member=member, CreditAmount=25)
Credit.objects.create(CreditDate=datetime.datetime.now(),
Member=member, CreditAmount=25.0) #FAIL

return render_to_response("Test.html")
except(Exception),e:
WriteToLog('error in test: ' + e.__str__())
return HttpResponseServerError('error')

Do I need to use @transaction.commit_manually instead? I know that
gives me the expected results but is a lot more work to update all my
code with manual commits and rollbacks. 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.



Django image upload

2011-10-05 Thread Ian
Hey Everyone,

I'm new to django, but I love it so far!

I'm trying to figure out how to upload an image (restrict it to images
only) and resave it as a different name.
Eventually, I'll want to upload it to S3, but for now, I'm just
testing it on my computer with runserver (so I'm not sure where it
should be saving it).

There are hundreds of tutorials for this online, but they are either
outdated or more complex than I'm looking for.

Right now, I have a template with the form in it.  I'm not sure where
to go from there.

Thanks so much!
Sorry if this question is too basic!

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



Re: @transaction.commit_on_success, not getting expected results

2011-10-05 Thread Javier Guerra Giraldez
On Wed, Oct 5, 2011 at 8:15 PM, robinne  wrote:
> @transaction.commit_on_success
> def Test(request):
>    try:
>        member = request.user.get_profile()
>        Credit.objects.create(CreditDate=datetime.datetime.now(),
> Member=member, CreditAmount=25)
>        Credit.objects.create(CreditDate=datetime.datetime.now(),
> Member=member, CreditAmount=25.0) #FAIL
>
>        return render_to_response("Test.html")
>    except(Exception),e:
>        WriteToLog('error in test: ' + e.__str__())
>        return HttpResponseServerError('error')

from the docs [1]:

"If the function returns successfully, then Django will commit all
work done within the function at that point. If the function raises an
exception, though, Django will roll back the transaction."

but you're catching any exception and returning an HttpResponse.  from
the point of view of Python, that's a successful function return, so
the transaction is committed.

if you want both: transaction rollback, and exception catching (to
turn them into log+HttpError), i think you should write your own
decorator, maybe something like (untested!):

def rollback_and_error(f, *args, **kwargs):
try:
with transaction.commit_on_success():
return f(*args, **kwargs)
except(Exception),e:
WriteToLog('error in %s: %s' %(f.__name__, e.__str__()))
return HttpResponseServerError('error')


[1]:https://docs.djangoproject.com/en/1.3/topics/db/transactions/#django.db.transaction.commit_on_success

-- 
Javier

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



Re: Beginner a bit lost - need some pointers please

2011-10-05 Thread kenneth gonsalves
On Wed, 2011-10-05 at 23:02 +0100, Chris G wrote:
> OK, so there isn't a single simple answer.  However it would still be
> really nice to see a complete two or three page django site with a
> database behind it fully implemented as an example.
> 
> 

this is as simple as it gets
https://bitbucket.org/lawgon/django-addition/overview
-- 
regards
Kenneth Gonsalves

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



post_add signal for non m2m

2011-10-05 Thread bino oetomo

Dear All ..

I read https://docs.djangoproject.com/en/1.2/topics/signals/
Looks like there is no "post_add" signal can be catched by listener 
function.


Is that true ?
I need to do some jobs each time a record is added to a model.
This model is not m2m, it's just a parent or child of one-2-many model.
post_add will :  do a http GET call to kannel sendsms interface

How to achieve this ?

Kindly please give me your enlightment.

Sincerely
-bino-

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