Re: looking for simple comment app

2009-10-14 Thread aschmid

this article helped me a lot!
http://www.yashh.com/blog/2008/nov/21/django-comments-authenticated-users/

On 14 Ott, 09:17, andreas schmid  wrote:
> hi,
>
> im looking for a simple comment app.
> i need commmenting for instances only by logged in users and the author
> is obviously request.user, dont need any preview or whatever. maybe a
> mail notification on instances i commented on.
>
> what are you using?
>
> i tried django.contrib.comments but its already too much for my taste
> and has too many fields.
> today i wanted to test django-reviews but it doesnt work even with the
> simple howto onhttp://packages.python.org/django-reviews/because i
> cant find any sample tamplates to make it work and the example in the
> package is an empty module.
>
> thank you!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, 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: problems (with mysql and) wsgi

2009-10-09 Thread aschmid

sry... mysql is not the problem. it should be a strict wsgi issue...
anyway i cant understand the problem. could it be that root should
have write permissions to the media folder because apache is started
as root?

On Oct 9, 3:53 pm, andreas schmid  wrote:
> hi,
>
> im experiencing problems with my project while im using mysql and wsgi.
> the problem happens when i want to create a user profile with an avatar.
> it works fine if i start the process with the runserver command.
>
> this is the error:http://www.pastebin.org/41177
>
>     OSError: [Errno 13] Permission denied:
>     '/opt/django/fslabs/fslabs/media/avatars/avatar-1726.gif
>
> does that mean that it has not the permission to upload the image to
> that path?
> because it doesnt create the profile at all.
> anyway the media folder is owned by the user django and all the
> executables too.
>
> my wsgi script looks like this:
>
>     #!/usr/bin/python
>
>     import sys
>     sys.path[0:0] = [
>       '/opt/src/django/eggs/djangorecipe-0.19.1-py2.5.egg',
>       '/opt/src/django/eggs/zc.recipe.egg-1.2.2-py2.5.egg',
>       '/opt/src/django/eggs/zc.buildout-1.4.1-py2.5.egg',
>       '/opt/src/django/eggs/setuptools-0.6c9-py2.5.egg',
>       '/opt/django/fslabs/parts/django',
>       '/opt/django/fslabs',
>       '/opt/django/fslabs/parts/site-packages',
>       ]
>
>     import djangorecipe.wsgi
>
>     application = djangorecipe.wsgi.main('fslabs.production', logfile='')
>
> and the apache configuration is:
>
>     
>     ServerName xxx.org
>
>     Alias /site-media/ /var/www/fslabs/media/
>
>     
>     Order deny,allow
>     Allow from all
>     
>
>     WSGIScriptAlias / /opt/django/fslabs/bin/django.wsgi
>
>     
>     Order deny,allow
>     Allow from all
>     
>
>     Alias /media/
>     /opt/django/fslabs/parts/django/django/contrib/admin/media/
>     
>     Order deny,allow
>     Allow from all
>     
>
>     
>
> the django project is symlinked in /var/www/
>
> could someone point me to the solution?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django and model field translations

2009-09-16 Thread aschmid

so i checked a few apps and im between django-transmeta and django-
multilingual, not sure yet what i should use. i have only one field
for every model which i want to be multilingual. the easier approach
would be the transmeta package at a first look...

is there anybody with a bit of experience using those apps which could
me point to the right choice?

thx

On Sep 14, 1:54 pm, andreas schmid  wrote:
> hi list,
>
> i have to develop a multilingual site and it works well on a single
> language now... but i have to do it for 3 languages translating some
> fields of the models.
>
> can you give me some tips for good available apps?
>
> my usecase is very simple. if a model has fields
>
>     * title
>     * description
>     * body
>
> i need to translate  description and body, title (==slug) will remain
> the same. the fact is that only one language should be required, the
> others are optional and if a visitor looks at a content thats not
> translated in the current language it should output a link to the
> canonical language.
>
> what is actually the best app to achieve that?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, 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 profiles question and http404

2009-09-03 Thread aschmid

as usual i solved by myself!
with something like this:

user = User.objects.get(username=username)
try:
profile_obj = user.get_profile()
except ObjectDoesNotExist:
return HttpResponseRedirect('/some/path/')


thank you anyway...

On Sep 3, 4:16 pm, andreas schmid  wrote:
> hi,
>
> im trying django-profiles and i like it but im not understanding why if
> a profile does not exist it has to output a http404. i think it doesnt
> has really much sense because if a profile is not yet created or not
> public it shouldnt give a 404 but a "im sorry but the profile is not
> available because has not been created or its not public".
>
> i looked at the profile_detail view and im trying to redirect to a
> "profile_does_not_exist" template but im experiencing problems because
> the profile request is made with a get_profile_or_404 method and i cant
> do a HttpResponseRedirect like:
>
>         user = get_object_or_404(User, username=username)
>         try:
>             profile_obj = user.get_profile()
>         except ObjectDoesNotExist:
>             return HttpResponseRedirect('http://some/url/')
>
> right?!
>
> how could i redirect to another template, view if the profile doesnt
> exist instead of the actual 404??
>
> i appreciate any help!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: question about custom save() and unique slug

2009-08-25 Thread aschmid

i solved it with:

def add_project(request):
if request.method == 'POST':
form = ProjectForm(data=request.POST)
if form.is_valid():
new_project = form.save(commit=False)
new_project.slug = new_project.title.lower().replace('
','-')
new_project.pub_date = datetime.datetime.now()
if Project.objects.filter(pub_date__year='%s' %
new_project.pub_date.year,
  slug__iexact='%s' %
new_project.slug) :
form = ProjectForm(data=request.POST)
else:
...


On Aug 25, 2:50 pm, andreas schmid  wrote:
> hi,
>
> i have a custom add method for a front end editing of my project model.
>
> now i have the problem that my url is composed by /year/slug and slug is
> set as unique for pub_date__year in the model. obviously this is not
> respected by my form so i want to check if the slug already exists for
> the given year but i cant find the right solution.
>
> here my code and i know its wrong:
>
>     def add_project(request):      
>         if request.method == 'POST':
>             form = ProjectForm(data=request.POST)
>             if form.is_valid():
>                 new_project = form.save(commit=False)
>                 projects = Project.objects.all()
>                 if new_project.slug == projects.slug :
>                     form = ProjectForm()
>                 else:
>                     new_project = form.save(commit=False)
>                     new_project.author = request.user
>                     new_project.pub_date = datetime.datetime.now()
>                     new_project.slug =
>     new_project.title.lower().replace(' ','-')
>
>                     new_project.percentage_to_pay_by_tis =
>     100-new_project.financing  
>                     calculationpercentage =
>     (100-new_project.financing)/100            
>                     new_project.amount_to_finance=
>     new_project.budget*calculationpercentage
>                     new_project.restamount_to_pay =
>     new_project.amount_to_finance- new_project.already_paid_amount_by_tis
>
>                     new_project.save()
>                     return
>     HttpResponseRedirect(new_project.get_absolute_url())
>         else:
>             form = ProjectForm()
>         return render_to_response('eufinance/project_form.html',
>                                       { 'form': form, 'add':True },
>
>     context_instance=RequestContext(request))
>
>     can anybody help me please...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, 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: generic views - please bring me to the point

2009-08-07 Thread aschmid

i got it!! the app was not in the pythonpath... :)

On Aug 7, 3:00 pm, andreas schmid  wrote:
> hi all,
>
> im really going crazy now i cant figure out where the code is wrong...
> i have a really simple model:
>
> from django.db import models
> import datetime
>
>     class Post(models.Model):
>         title = models.CharField(max_length=250)
>         excerpt = models.TextField(blank=True)
>         body = models.TextField()
>         pub_date = models.DateTimeField(default=datetime.datetime.now)
>         slug = models.SlugField(unique_for_date='pub_date')
>
>         class Meta:
>           verbose_name_plural = "Posts"
>           ordering = ['-pub_date']
>
>         def __unicode__(self):
>           return self.title
>
>         def get_absolute_url(self):
>           return ('wynton_post_detail', (), {  'year':
>     self.pub_date.strftime("%Y"),
>                                                   'month':
>     self.pub_date.strftime("%b").lower(),
>                                                   'day':
>     self.pub_date.strftime("%d"),
>                                                   'slug': self.slug })
>         get_absolute_url = models.permalink(get_absolute_url)
>
> my urls file:
>
>     from django.conf.urls.defaults import *
>     from wynton.models import Post
>
>     post_info_dict = {
>             'queryset': Post.objects.all(),
>             'date_field': 'pub_date',
>             }
>
>     urlpatterns = patterns('django.views.generic.date_based',
>
>              (r'archive/^$', 'archive_index', post_info_dict,
>     'wynton_post_archive_index'),
>     ...
>     )
>
> my post_archive.html
>
>         {% for object in latest %}
>           {{ object.title }}
>         {% endfor %}
>
> but nothing is showing up in the page but the template is loaded
> correctly...
> please help me before i crash my head to the wall! ;)
>
> thx
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---