Re: How to make fields mandatory for User

2009-10-09 Thread Bayuadji

Hi Gerard,

On 10/9/09, Gerard  wrote:
>
> Hi all,
>
> I need the fields first_name and last_name of Django's User object to be
> mandatory when creating users via the Admin interface. Is there an easy way
> to do this?

The one thing that comes to my mind,
is either inherit the User objects,
or change the form in User Admin.

but I think both of them is not so easy anyway.

-djibon-

-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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

Hi,

On 10/9/09, aschmid  wrote:
>
> 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?

it seems that you have a permission problem.
try to change the folder /opt/django/fslabs/fslabs/media/
so that it could read/write by anyone,  0640 I think enough.

or put a django wsgi user to root group.

-adji-


-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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

2009-10-09 Thread Bayuadji

Hi Chirolo

On 10/9/09, Chirolo  wrote:
> My question is which file or directory controls this webserverprocess?
> or what can I do to solve my problem.
> Thank you in advance.
> Here is the error output that I get:
> File "/usr/lib/python2.5/os.py" in makedirs
>   164. makedirs(head, mode)
> File "/usr/lib/python2.5/os.py" in makedirs
>   164. makedirs(head, mode)
> File "/usr/lib/python2.5/os.py" in makedirs
>   164. makedirs(head, mode)
> File "/usr/lib/python2.5/os.py" in makedirs
>   171. mkdir(name, mode)
>
> Exception Type: OSError at /imageupload/
> Exception Value: [Errno 13] Permission denied: '/home/Djangoprojects'
>

I think the error comes when creating a directory though.
have you change the permission for '/home/Djangoprojects'?

-djibon-

-- 
------
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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

2009-10-09 Thread Bayuadji

Hi Shuge Lee,



On 10/9/09, Shuge Lee  wrote:
>
> Environment: ubuntu 9.04 + django 1.1 + apache 2.*
>
> I did following https://wiki.ubuntu.com/Django
>
> however, I got this error message
> http://dpaste.com/105064/
>
> My configure file:
> cat /etc/apache2/sites-available/online
> http://dpaste.com/105065/
>
> The file and path structure of my django project:
> http://dpaste.com/105066/
>
> r...@shuge-lab:/var/www# ls -l   /home/share/shuge/shuge-online/
> online/ | grep static
> drwxrwxrwx 10 li   li4096 2009-10-08 18:25 static

I just wondering, whether you are create a directory in your settings.py.
because the error comes after import your settings.py

cheers
-djibon-

--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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

2009-10-09 Thread Bayuadji

On 10/9/09, Kristaps Kūlis  wrote:
> Hello
>
>  I have such models:
>
>  Class Model1(models.Model):
>[content]
>  Class Model2(models.Model):
>model1 = models.ForeignKey(Model1)
>
>  How to ensure that Model1 has at least 1 referenced model ?
> data are added using django admin interface, which inlineadmins

Hi,

How about using OneToOneField instead ForeignKey
http://docs.djangoproject.com/en/dev/ref/models/fields/#onetoonefield

cheers
-djibon-

-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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

2009-10-11 Thread Bayuadji

Hi Denis,

have you put self on your unicode function?
its __unicode__(self) not __unicode()__

regards
djibon

On 10/11/09, Denis Bahati  wrote:
> Thanx a lot for the information, but i managed to get it working before this
> information.
> I have another problem that the __unicode()__ is not working. It just gives
> me Poll object instead of the name of data from the database, i put the
> function at the beginning of the line, but if i put a tab to indent so that
> it is read as the function of the poll, it gives me error. any idea?
>
> On Sat, Oct 10, 2009 at 8:59 AM, Daniel Roseman
> wrote:
>
>>
>> On Oct 10, 3:43 pm, djbahati  wrote:
>> > Hi All,
>> > Am new to django,
>> > am developing application but i face a problem in displaying template.
>> > The browser does not display any template it just display plain text.
>> > am using django 1.1 and xampp 1.7.1. Any idea?
>>
>> http://docs.djangoproject.com/en/dev/howto/static-files/
>> --
>> DR.
>> >
>>
>
> >
>


-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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



Re: how to get back to a view requiring login

2009-10-11 Thread Bayuadji

On 10/11/09, Florian Schweikert  wrote:
> 2009/10/12 Sergio A. 
>
>>
>> I've three views each with different URL. They are visible to logged
>> in users.
>> If a non-logged user tries to access a URL requiring login, I'm able
>> to redirect it to the login page.
>>
>> What I'm missing is how to go back to the initial page, once the user
>> log in the system.
>>
>>
>> Cheers, Sergio
>> >
>>
> @login_required redirection using ?next=/path (I'm not 100% sure if this is
> default)
> your login have to look at this GET var
>
> greets,
> Florian

Yes,

I always use this kind mechanism though

-djibon-

--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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

2009-10-13 Thread Bayuadji

Hi,

Imho there's a MEDIA_URL field in settings,
so you could use that, and uset {% MEDIA_URL %} in your template (you
could also add template context processors)

-djibon-

On 10/13/09, rvandam  wrote:
>
> I am working on a site with a static part (i use the Djano tempate
> system to separate menu's and header from the content), and a dynamic
> part. For the static part i have a directory structure like:
>
> index.html
> page1.html
> page2.html
>
> request for / will load index.html
>
> A part of my urls.py:
>  (r'^$', 'django.views.generic.simple.direct_to_template',
> {'template': 'index.html'}),
>  (r'^index.html$',
> 'django.views.generic.simple.direct_to_template', {'template':
> 'index.html'}),
>
> The "trouble" starts when i want to add forms to the site. Forms only
> work from a subdirectory like /forms/ When i use the same parent
> template as above the media link is not right anymore. Is /media/css/
> style.css, should be ../media/css/style.css
>
> How should i handle this? I could hardlink the media files in the
> template (like http://mydomain.com/media/css/style.css) but then i
> have to edit every template. This will also be a big pain when i
> switch the domain.
>
> I could also have multiple parent templates, but this solution is not
> satisfactory for me either.
>
> Changing the urls from index.html into /index/ could also work, but
> then i have a problem with requests for / (i could redirect these to /
> index/ but i don't know if i am happy with that).
>
> What is the right approach for this?
> >
>


-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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

2009-10-14 Thread Bayuadji

hi,

>>tag = Tag.objects.get(name=unslug)

how about change that into:
tag = Tag.objects.get(name__iexact=unslug)
so it not case sensitive.
http://docs.djangoproject.com/en/dev/ref/models/querysets/#ref-models-querysets

-djibon-

On 10/14/09, grimmus  wrote:
>
> Hi,
>
> I followed the excellent Web Monkey tutorial on setting up a blog
> using Django. It makes use of Django Tagging. If a tag is entered like
> 'Tag' it is not found if you search for 'tag' . I would like it so the
> case of the tag doesnt matter because when i apply slugify in my
> template the tag gets converted to lowercase.
>
> Tag_views.py
>
> def tag_detail(request, slug):
> unslug = slug.replace('-', ' ')
> tag = Tag.objects.get(name=unslug)
>
> qs = TaggedItem.objects.get_by_model(Link, tag)
> return object_list(request, queryset=qs, extra_context=
> {'tag':slug}, template_name='tags/detail.html')
>
> def tag_list(request):
> tags = Tag.objects.all()
> return object_list(request,queryset=tags, template_name='tags/
> list.html')
>
> In my template
>
> tags: {% for tag in object.get_tags %}{{tag}} {% endfor %}
>
> Of course i could remove slugify but there must be an easy way to
> ignore the case of the tag ??
>
> Thanks in advance
> >
>


-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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

2009-10-14 Thread Bayuadji

hi,

imho request.user.is_authenticated and request.user.is_anonymous

-djibon-

On 10/14/09, robin nanola  wrote:
> try request.user
>
> you get a key error coz there is no  'REMOTE_USER' key in META.
>
> On Wed, Oct 14, 2009 at 5:29 PM, luca72  wrote:
>
>>
>> Hello if i use request.META['REMOTE_USER'] i get key error, but if i
>> use 'REMOTE_HOST' not
>> can you tell me how to get the user that is authenticate
>> I use the decorator @login_required and so the user is authenticated
>> correct?
>>
>> Regards
>>
>> Luca
>> >
>>
>
> >
>


-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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

2009-10-14 Thread Bayuadji

Hi,

I don't think there's an easy way.
except that you customize your model save function

-djibon-
On 10/14/09, Zilva  wrote:
>
> like auto_now_add
> >
>


-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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



Re: Admin Settings

2009-10-14 Thread Bayuadji

or create a function that return object.foreign_key.field1.
then use the function in list_display

cheers.
-djibon-

On 10/14/09, justquick  wrote:
>
> try using 'foreign_key__field1' instead
>
> On Oct 14, 12:04 pm, freeav8r  wrote:
>> Is it possible to do something like this:
>>
>> class MyModelAdmin(admin.ModelAdmin):
>>     list_display = (‘field1’, field2’, ‘foreign_key’,
>> ‘foreign_key.field1’, foreign_key.field2’,)
>>
>> admin.site.register(MyModel, MyModelAdmin)
>>
>> ‘foreign_key’ works just fine, but ‘foreign_key.field1’ and
>> ‘foreign_key.field2’ error out.  Any suggestions?
> >
>


-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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



Re: Can't get css working

2009-10-15 Thread Bayuadji

Hi Bruno,

Nice tips you got.
thanks :)

-djibon-

On 10/15/09, bruno desthuilliers  wrote:
>
> On 14 oct, 19:34, David  wrote:
>> Thanks JIm, didn't solve my problem, but always good to learn some
>> best practices. Any particular reason  why
>> {'document_root' : os.path.join(settings.CURRENT_PATH,"media_site") })
>> is better than
>> {'document_root': settings.MEDIA_ROOT}
>> in settings.py?
>
> Obviously none, except a failure to spot this repetition, I'd say !-)
>
> Here's what we usually do here for dev settings - as DRY as possible:
>
> ##  settings.py 
> import os
>
> # typical default dev server setting
> DEV_SERVER=True
> PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
> PROJECT_URL = 'http://127.0.0.1:8000'
>
> # easier to use the same componant for URL and PATH
> MEDIA_DIR = "site_media"
>
> # the MEDIA_ROOT must end with a path separator AFAICT
> MEDIA_ROOT = os.path.join(PROJECT_PATH, MEDIA_DIR) + os.path.sep
>
> # use the fully qualified URL
> # NB : we don't use os.path.join here - it's an url, not a system path
> MEDIA_URL = "%s/%s/" % (PROJECT_URL, MEDIA_DIR)
>
> # don't forget the media processor for {{ MEDIA_URL }} in the
> templates
> TEMPLATE_CONTEXT_PROCESSORS = (
> # 
> "django.core.context_processors.media",
> # 
> )
>
>
> ##  urls.py 
> from django.conf.urls.defaults import *
> from django.conf import settings
>
> urlpatterns = patterns(
> '',
> # urls here
> )
>
> if settings.get("DEV_SERVER", False):
> urlpatterns += patterns(
> '',
> # static stuff
> (r'^%s/(?P.*)$' % settings.MEDIA_DIR,
>  'django.views.static.serve',
>  {'document_root': settings.MEDIA_ROOT}
> ),
>   )
>
>
> ##  base.html 
> 
>   
> >
>
> {% block title %}My project's title{% endblock %}
>
> 
> 
>
>  etc
> 
> 
>
>
> This WorksForUs(tm) so far - as long as the dev server's user has read
> access on MEDIA_ROOT and it's content of course !-)
>
> HTH
>
> >
>


-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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

2009-10-15 Thread Bayuadji

Hi,

You could override save on Model instead.

-djibon-

On 10/15/09, eka  wrote:
>
> Hi all
>
> I need to override the ModelAdmin save_model and I found out that is
> not being called. I checked the documentation where it says how to use
> it and the searched around the code to see if there is a call to that
> method and can't find any call to save_model anywhere in all Django
> src (versions 1.0 and 1.1).
>
> http://docs.djangoproject.com/en/1.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_model
>
> Any clue? Is this not implemented? Bug? Or I'm missing something?
>
> Regards
>
> Esteban (eka)
> >
>


-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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

2009-10-16 Thread Bayuadji

Hi,

perhaps you could create clean_*date in your form,
and change the datefield 10-OCT-09 to 10-10-2009

-djibon-


On 10/16/09, vishak  wrote:
>
> what you have told is OK but when you enter in datefield 10-OCT-09
> instead of 2009-10-10 it gives error.
>
> On Oct 16, 4:41 pm, Михаил Лукин  wrote:
>> Try thishttp://docs.djangoproject.com/en/dev/ref/settings/#date-format
>>
>>
>>
>> On Fri, Oct 16, 2009 at 2:21 PM, vishak  wrote:
>>
>> > Hi Django users,
>>
>> >   I have one question in django for which details are given below
>>
>> > 1] The default date format in django is '`2009-10-10' when entered
>> > through frontend (i.e by using models.DateField()).  I manipulated
>> > this behavior to '10-OCT-09'.
>>
>> > 2] Everything is fine upto now, but when i save the data the django
>> > validation error comes saying
>> > "Date format should be -mm-dd".
>>
>> > Can anyone provide a solution to override this behavior of django and
>> > also explain why django supports only '-mm-dd' format.
>>
>> > Thanks in advance
>>
>> > Vishak.V
>>
>> --
>> regards,
>> Mihail
> >
>


-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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

2009-10-16 Thread Bayuadji

Perhaps also should set some response headers to svg type?

On 10/16/09, Javier Guerra  wrote:
>
> On Fri, Oct 16, 2009 at 2:35 PM, claytonbonelli  wrote:
>> The image file is displayed on
>> my html page, but the SVG file dont.
>
> maybe some mime-type configuration missing?
>
>
> --
> Javier
>
> >
>


-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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

2009-10-16 Thread Bayuadji

Hi,

I would check by running a shell and impor ssl_test.views.
if its work correctly, perhaps there's some import circular dependency though.

-djibon-

On 10/16/09, neri...@gmail.com  wrote:
>
> I'm not sure why I'm getting this error when the module and view are
> right where they should be.
>
> Traceback:
> File "/usr/lib/python2.6/dist-packages/django/core/handlers/base.py"
> in get_response
>   83. request.path_info)
> File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
> resolve
>   218. sub_match = pattern.resolve(new_path)
> File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
> resolve
>   125. return self.callback, args, kwargs
> File "/usr/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
> _get_callback
>   134. raise ViewDoesNotExist, "Could not import %s. Error
> was: %s" % (mod_name, str(e))
>
> Exception Type: ViewDoesNotExist at /
> Exception Value: Could not import ssl_test.views. Error was: No module
> named ssl_test.views
> >
>


-- 
------
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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

2009-10-18 Thread Bayuadji

HI,

=>> I tend to start with the models first and when I add a field, I
just use alter
>> to update the table in place. This has a gotcha with NOT NULL though, if you
>> don't specify a default you'll end up with an error.  To bypass this error, I
>> usually don't add the NOT NULL constraint till after I've added the field and
>> updated the existing rows with the required data.
>>
> I might have to end up using this approach since it seems like a
> relatively easy solution. It seems to me that this sort of thing is
> the kind of thing that just requires a little repetition and grinding
> (especially with a lot of changes...)

Yes, I do this in my current project.
but a lot of change in models sometimes create a not so nice works.
I am planning to integrate south though.

-djibon-

-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, 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: Do I have to pass the httprequest object to render_to_response every time?

2009-10-22 Thread Bayuadji

IMHO Yes,
otherwise the context_processor variable won't be available in template

-djibon-

On Thu, Oct 22, 2009 at 11:43 AM, jul  wrote:
>
> But I still have to pass RequestContext(request) to render_to_response
> if I'm not using generic views, right?
>
> On Oct 21, 8:38 pm, Andrew Ingram  wrote:
>> jul wrote:
>> > hi,
>>
>> > in my base.html template I've got a header which needs httprequest
>> > (request.path, request.user.is_authenticated...).
>> > In all my views I'm passing the request object to render_to_response.
>> > Is there any better way to do that?
>>
>> > thanks
>> > jul
>>
>> Hi jul,
>>
>> There is a context processor that comes as part of django that gives you
>> access to the request object:
>>
>> http://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-c...
>>
>> as long as you have it specified in your settings.py, it will
>> automatically become available if you use render_to_response
>>
>> Regards,
>> Andrew Ingram
> >
>



-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, 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: Apache's 500 error overriding Django 500 view

2009-11-07 Thread Bayuadji

Hi,

I've experienced when there's an error in our templatecontext
processing, so instead our 500.html our application using apache
500.html

perhaps you should check your log, to see there's an exception.

-djibon-

On Fri, Nov 6, 2009 at 4:05 PM, Maksymus007  wrote:
>
> On Fri, Nov 6, 2009 at 9:34 PM, Brandon Taylor  
> wrote:
>>
>> Hi everyone,
>>
>> I'm doing my development on Ubuntu 9.1, Python 2.6.4, Apache2/mod_wsgi
>> and Django 1.1.1. When setting DEBUG = False, and creating a view that
>> I know will raise an exception, Apache's 500 error will show instead
>> of the Django 500 view.
>>
>> I have created the 500.html template in my root templates directory
>> I have set debug = False
>> I have even set the "handler500" URL to point to my
>> 'app.views.my_server_error_500'
>>
>> and the Apache error screen will still show up.
>>
>> Anyone have any idea why?
>>
>
> not all exceptions are handled by django - for example syntax errors.
> What kind of errors is yours?
>
> >
>



-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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



Re: how to keep the FileField being unmodified ?

2009-11-07 Thread Bayuadji

Hi,

The easy way is to check in backend, if the filefield empty,
don't modified the value.

-djibon-

On Sat, Nov 7, 2009 at 9:54 PM, hao he  wrote:
> I display a ModelForm.
> if user edit the field, ModelForm.save() will save the edited field,and the
> non-edited field keep its origin value.
>
> but, FileField/ImageField do not act as that.
> if users have not modified the FieldField,  it will be empty.
>
> how to implement that?
>
> thanks.
>
> >
>



-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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



Form text from database

2009-11-30 Thread Bayuadji
Hi all,

There's a requirement in my project that the text for form field and field error
could be specified from database, so that the admin can change the
text and the error text as he/she like.

could it be done? and also any suggestions about this problem is welcome

thanks
-djibon-

-- 
--
http://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

--

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

2010-01-17 Thread Bayuadji
if I were you,
I also will create a django command to call the utility,
it much easier that way.

-djibon-

On Mon, Jan 18, 2010 at 7:20 AM, nek4life  wrote:
> On Jan 17, 4:58 pm, lance  wrote:
>> Python/Django newbie question:
>>
>> I need to create a cron job that fetches json data from a URL, parses
>> it (presumably using simplejson) and then load the data into my
>> database using the Django models I've defined.
>>
>> I'm having trouble finding any tips, examples, or documentation on how
>> to do this... any help is greatly appreciated.
>
> I did something similar using the delicious api and elementtree to
> parse the data.
>
> First I created a module called utils.py in my application package and
> wrote a script for grabbing the url, parsing the data and updating the
> database.  Then I created another script called cron.py to run the
> utils.py every so often.  In the cron script you'll have to set your
> environmental variables for your project like so.
>
> import os
> import sys
> import site
>
> site.addsitedir('/opt/pythonenv/example.com/lib/python2.5/site-
> packages') # virtual environment
> sys.path.append('/var/www/vhosts/example.com/') # project location
> os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings' # settings
> file
>
> # import your module and then call it
>
> As far as using simplejson goes I haven't used it before.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, 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://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, 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: No module name error

2010-05-06 Thread Bayuadji
Hi,

I don't know which version of django-registration you use,
but the source on views.py doesn't have any profiles.utils

see 
:http://bitbucket.org/ubernostrum/django-registration/src/tip/registration/views.py

-adji-

On Fri, May 7, 2010 at 9:19 AM, newbiedjango  wrote:
> hi all,
> i am a newbie in django and have been trying to get this django-
> registration app working with few extra fields.
>
> now i am getting his module error
>
> http://dpaste.com/191756/
>
> please help fixing me this error..
>
> 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-us...@googlegroups.com.
> To unsubscribe from this group, 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://www.tumbletooth.org
my linkedin profile : http://www.linkedin.com/in/bayuadji
--

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

2010-05-06 Thread Bayuadji
see this line
import profiles.utils

in views.py on django registration doesn't have that line. so I think
you or someone already customized the registration apps

-adji-

On Fri, May 7, 2010 at 9:57 AM, newbiedjango  wrote:
> my views.py is
> down here which is an extension of
> http://bitbucket.org/ubernostrum/django-registration/src/tip/registration/views.py
> I am a total newbie here and don't know much about this..kindly
> help...
>
> from django.shortcuts import redirect
> from django.shortcuts import render_to_response
> from django.template import RequestContext
> import profiles.utils
> from registration.backends import get_backend
>
>
> def activate(request, backend,
>             template_name='registration/activate.html',
>             success_url=None, extra_context=None, **kwargs):
>
>    backend = get_backend(backend)
>    account = backend.activate(request, **kwargs)
>
>    if account:
>        if success_url is None:
>            to, args, kwargs =
> backend.post_activation_redirect(request, account)
>            return redirect(to, *args, **kwargs)
>        else:
>            return redirect(success_url)
>
>    if extra_context is None:
>        extra_context = {}
>    context = RequestContext(request)
>    for key, value in extra_context.items():
>        context[key] = callable(value) and value() or value
>
>    return render_to_response(template_name,
>                              kwargs,
>                              context_instance=context)
>
> def ug_zero_suffix(form_data):
>    return form_data['username'] + '0'
>
> username_generators = [ug_zero_suffix]
>
> # Not a view function (helper function)
> def generate_username_suggestions(form_data):
>
>    MAX_SUGGESTIONS = 5
>    suggestions = []
>
>    for gen in username_generators:
>        for suggestion in gen(form_data):
>            if (suggestion != None):
>                suggestions.append(suggestion)
>                if (length(suggestions) >= MAX_SUGGESTIONS):
>                    return suggestions
>
>    # TODO make sure that we handle not generating enough
> suggestions
>    return suggestions
>
> def register(request, backend, success_url=None,
> form_class=RegistrationForm, profile_callback=None,
>             template_name='registration/registration_form.html',
>             extra_context=None):
>                pform_class = profiles.utils.get_profile_form()
>                if request.method =='POST':
>                    profileform = pform_class(data=request.POST,
> files=request.FILES)
>                    form = form_class(data=request.POST,
> files=request.FILES)
>                    if form.is_valid():
>                        new_user = form.save()
>                        profile_obj = profileform.save(commit=False)
>                        profile_obj.user = new_user
>                        profile_obj.save()
>                        return HttpResponseRedirect('/accounts/
> register/complete/')
>                    else:
>                        form = form_class()
>                        profileform = pform_class()
>                if exra_context is None:
>                    extra_context = {}
>                    context = RequestContext(request)
>                    for key, value in extra_context.items():
>                        context[key] = callable(value) and value() or
> value
>                return render_to_response(template_name,
> {'form':form,'profileform':profileform,'context_instance':context})
>
> def register(request, backend, success_url=None, form_class=None,
>             disallowed_url='registration_disallowed',
>             template_name='registration/registration_form.html',
>             extra_context=None):
>    backend = get_backend(backend)
>    if not backend.registration_allowed(request):
>        return redirect(disallowed_url)
>    if form_class is None:
>        form_class = backend.get_form_class(request)
>
>    if request.method == 'POST':
>        form = form_class(data=request.POST, files=request.FILES)
>        if form.is_valid():
>            new_user = backend.register(request, **form.cleaned_data)
>            if success_url is None:
>                to, args, kwargs =
> backend.post_registration_redirect(request, new_user)
>                return redirect(to, *args, **kwargs)
>            else:
>                return redirect(success_url)
>        #else:
>            # generate suggestions which can be passed into the
> template
>    else:
>        form = form_class()
>
>    if ex

Re: Problem of installing haystack and thumbnail a python app

2011-03-07 Thread bayuadji
Hi,

looked from your staktrace it seems that python didn't found thumbnail and 
haystack library.

You could check by running sys.path from your django shell


-adji-
-Original Message-
From: yozloy 
Sender: django-users@googlegroups.com
Date: Sun, 6 Mar 2011 20:50:28 
To: 
Reply-To: django-users@googlegroups.com
Subject: Problem of installing haystack and thumbnail a python app

Hey guys
I'm new to Python, I want to install this python app called 
mirosubson my VPS, and I followed the 
installation guide in this github pages, when 
I got to the step 8: 

python manage.py syncdb

I got the following error:

root@makserver:/usr/local/src/mirosubs# python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 35, in 
execute_manager(settings)
  File 
"/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/core/management/__init__.py",
 
line 438, in execute_manager
utility.execute()
  File 
"/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/core/management/__init__.py",
 
line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/core/management/__init__.py",
 
line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
  File 
"/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/core/management/__init__.py",
 
line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, 
name))
  File 
"/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/utils/importlib.py",
 
line 35, in import_module
__import__(name)
  File 
"/usr/local/lib/python2.6/dist-packages/South-0.7.3-py2.6.egg/south/management/commands/__init__.py",
 
line 10, in 
import django.template.loaders.app_directories
  File 
"/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/template/loaders/app_directories.py",
 
line 23, in 
raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
django.core.exceptions.ImproperlyConfigured: ImportError haystack: 
cannot import name Thumbnail

Anybody can tell me how to solve this 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.


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