Re: Django - Query

2013-05-05 Thread Aljoša Mohorović
something like: try: # code except Movie.DoesNotExist: # code except Movie.MultipleObjectsReturned: # code except: # catch all exceptions check http://docs.python.org/2/tutorial/errors.html#handling-exceptions Aljosa -- You received this message because you are subscribed to

Re: Reloading modules during development

2013-05-05 Thread Aljoša Mohorović
django has development server which autoreloads check https://docs.djangoproject.com/en/1.5/ref/django-admin/ Aljosa -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an

Re: Please help in starting up with Django App Template - Just started up with Django

2013-05-05 Thread Aljoša Mohorović
i'm not using windows but if it's in site-packages it will be on PYTHONPATH. check http://docs.python.org/2/using/cmdline.html?highlight=pythonpath#envvar-PYTHONPATH Aljosa -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

Re: Django - Query

2013-05-05 Thread Aljoša Mohorović
you're catching DoesNotExist but should also catch MultipleObjectsReturned check https://docs.djangoproject.com/en/1.5/ref/exceptions/ Aljosa -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

Re: Please help in starting up with Django App Template - Just started up with Django

2013-05-05 Thread Aljoša Mohorović
while virtualenv is activated execute in shell: $ pip install -r requirements.txt requirements.txt is the file located in django-classifieds/requirements.txt which contains list of dependencies required. Aljosa -- You received this message because you are subscribed to the Google Groups

Re: Need good image on the fly resizing

2013-04-22 Thread Aljoša Mohorović
check http://django-imagekit.readthedocs.org Aljosa -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this

Re: django + TinyMce

2012-08-20 Thread Aljoša Mohorović
HTMLField() is probably the easiest way to use django-tinymce: http://django-tinymce.readthedocs.org/en/latest/usage.html#the-htmlfield-model-field-type let me know if you have any issues. Aljosa -- https://twitter.com/maljosa https://github.com/aljosa -- You received this message because you

Re: django + TinyMce

2012-08-20 Thread Aljoša Mohorović
skip step #4, 1-3 should be enough: http://django-tinymce.readthedocs.org/en/latest/installation.html#id2 Aljosa -- https://twitter.com/maljosa https://github.com/aljosa -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Login/ Logout user details

2012-08-09 Thread Aljoša Mohorović
On Thu, Aug 9, 2012 at 1:19 PM, Pervez Mulla wrote: > Please tell me how can I know ,the details about user login and logout > details , and how can I store that data in DB in Django. User model (auth.models.User) has last_login and if you need custom data stored you can

Re: TinyMCE config

2012-08-05 Thread Aljoša Mohorović
On Fri, Aug 3, 2012 at 6:20 PM, Jonathan Baker wrote: > If you're up for it, I'd love to help update the documentation to save > future users (and yourself) some time with the issues I ran in to. sure, just send pull requests for

Re: TinyMCE config

2012-08-03 Thread Aljoša Mohorović
documentation is not completely updated so steps in previous emails are correct. i won't be available until next week but check second snippet under: http://django-tinymce.readthedocs.org/en/latest/usage.html#the-flatpages-link-list-view and be sure that you have something like: """

Re: TinyMCE config

2012-08-02 Thread Aljoša Mohorović
On Thu, Aug 2, 2012 at 3:19 AM, jondbaker wrote: > TINYMCE_JS_URL = os.path.join(PROJECT_ROOT, > 'templates/static/js/tiny_mce/tiny_mce.js') > TINYMCE_JS_ROOT = os.path.join(PROJECT_ROOT, 'templates/static/js/tiny_mce') You don't need to set

Re: django comments with tinymce

2012-07-17 Thread Aljoša Mohorović
On Tue, Jul 17, 2012 at 10:47 AM, Benasg wrote: > Hello, when I using django comments without tinymce it`s works perfect, but > when I add tiny I get error "This field is required". > Any suggestion? can you post models.py code before and after you added tinymce?

Re: uploading images via API

2012-06-04 Thread Aljoša Mohorović
take a look at gist w/ base64 file upload solution: https://github.com/toastdriven/django-tastypie/issues/42 it works great, you can add Base64FileField implementation to your app (it's only ~15 lines of code) and you can upload from anything that can open a file and encode it. you can also use

Re: How to install django-mce?

2012-04-08 Thread Aljoša Mohorović
On Sun, Apr 8, 2012 at 10:34 PM, Roy Smith wrote: > I'm trying to install django-tinymce 1.5.1b2 into a django-1.3 site.  The just use "pip install django-tinymce" > directories, but no tiny_mce directory under those.  Even odder, the media > and static trees look like identical

Re: UnicodeEncodeError in file uploads

2012-03-01 Thread Aljoša Mohorović
On Thu, Mar 1, 2012 at 6:16 PM, andi-h wrote: > Would it help to change the locale settings on this Ubuntu server to > de_DE.UTF-8, too? don't know, but give it a shot. also, what's the output of: $ locale -a Aljosa -- You received this message because you are

Re: UnicodeEncodeError in file uploads

2012-03-01 Thread Aljoša Mohorović
although it's possible that this is not the problem, could you post additional details after you restart apache: 1) envvars content $ cat /etc/apache2/envvars 2) env settings for apache/site user (usually www-data): $ cat /etc/default/locale $ sudo su - www-data $ export Aljosa -- You received

Re: UnicodeEncodeError in file uploads

2012-03-01 Thread Aljoša Mohorović
if you're using apache please check /etc/apache2/envvars and make sure that LANG is not C. if you uncomment system locale it should work as expected. ## Uncomment the following line to use the system default locale instead: . /etc/default/locale Aljosa Mohorovic -- You received this message

Re: django-mptt compared w/ django-treebeard

2012-02-03 Thread Aljoša Mohorović
On Thu, Feb 2, 2012 at 8:13 PM, creecode wrote: > I wouldn't assume that just because something hasn't been updated for awhile > that it isn't good. like i said, i've used treebeard w/o problems so i don't think it's bad. my question/interest is mostly because i've noticed

why are csrf (403) errors ignored?

2011-11-20 Thread Aljoša Mohorović
is this a design decision? i would expect that csrf 403 errors are as important as 404/500 and reported by default. anybody using some custom settings to log csrf errors? what's your experience with logging csrf errors? Aljosa -- You received this message because you are subscribed to the

Re: custom widgets: passing data between widget/field/form/model

2011-10-21 Thread Aljoša Mohorović
any other comments/suggestions on this? Aljosa -- 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

Re: custom widgets: passing data between widget/field/form/model

2011-10-19 Thread Aljoša Mohorović
On Wed, Oct 19, 2011 at 1:21 PM, Tom Evans wrote: > I suggest you rethink your approach. Subclassing ForeignKey so that > you can build a better widget does not seem sane. Why do you think > this would help? because the simplest way to make it reusable is to have "from

custom widgets: passing data between widget/field/form/model

2011-10-19 Thread Aljoša Mohorović
i'm subclassing ForeignKey but can't figure out howto access actual instance (model data). if i'm doing "class MyField(ForeignKey)", what do i need to override, which MyField method, where i have access to related instance data (or None if it doesn't exists)? digging through the code i've found

Re: howto disable label for field in admin app form?

2011-10-04 Thread Aljoša Mohorović
On Tue, Oct 4, 2011 at 2:46 PM, Ivan Ivanov wrote: > I think, this is exactly what you want. i need to do this on field level, not form. thanks for suggestion. javascript works just fine in this case -- You received this message because you are subscribed to the Google

Re: howto disable label for field in admin app form?

2011-10-04 Thread Aljoša Mohorović
On Tue, Oct 4, 2011 at 2:22 PM, BILLION Sébastien wrote: > It's a strange question... > You can replace an admin template with {% extends "admin/change_form.html %} > for example. i don't see why it's a strange question, i have a form field and i would like to

Re: howto disable label for field in admin app form?

2011-10-04 Thread Aljoša Mohorović
On Tue, Oct 4, 2011 at 2:20 PM, Иван Иванов wrote: > You can loop through the fields of the form and show only those parts > of the field, you need: > > https://docs.djangoproject.com/en/dev/topics/forms/#looping-over-the-form-s-fields not exactly what i'm looking for

howto disable label for field in admin app form?

2011-10-04 Thread Aljoša Mohorović
is it possible to disable rendering of label for field in forms? i would like to render a field in a custom form (admin add/edit form) w/o label. any info/tips appreciated Aljosa -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

access model/instance from custom field/widget

2011-10-04 Thread Aljoša Mohorović
if i have a modelform with custom field and widget how can i access current model/instance (or None) in field/widget? is it possible? Aljosa -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

3rd party apps with staticfiles support - howto support older versions

2011-10-04 Thread Aljoša Mohorović
given that since django v1.3 staticfiles are included and media folder is now static folder, how can a 3rd party app support v1.3 and previous releases w/o creating duplicated content in 2 folders (media and static)? Aljosa -- You received this message because you are subscribed to the Google

Re: How TinyMCE don't displays Html tags to vistors

2011-09-20 Thread Aljoša Mohorović
On Tue, Sep 20, 2011 at 8:18 AM, Tsung-Hsien wrote: > I've been done my admin interface with TinyMCE. However,  aftering > editing, I see words with HTML tags update to my website. > > What's a good way to solve this? you need to add "{{ tinymce_content|safe }}", docs:

Re: Https with runserver

2011-09-14 Thread Aljoša Mohorović
if you need to simulate https for development, like for facebook apps, you can setup apache proxy. something like: ProxyPass / http://localhost:8000/ retry=1 ProxyPassReverse / http://localhost:8000/ ProxyPreserveHost On ErrorLog ${APACHE_LOG_DIR}/error.log

staticfiles - media and static folders, any way to avoid duplicated content?

2011-04-28 Thread Aljoša Mohorović
if i support both staticfiles and django.contrib.staticfiles i need to copy content from media folder to static folder so when i create a python package i have media and static folders with the same content. any way to avoid this and still support both? Aljosa Mohorovic -- You received this

limit_choices_to (or some other way) to filter ForeignKey choices based on current model field

2011-04-16 Thread Aljoša Mohorović
if i have something like this: === class MyModel(models.Model): name = models.CharField(max_length=255) class OtherModel(models.Model): name = models.CharField(max_length=255) mymodel = models.ForeignKey(MyModel) class MyModelItem(models.Model): mymodel =

Re: Facebook session problems.

2011-01-31 Thread Aljoša Mohorović
On Mon, Jan 31, 2011 at 2:59 PM, CrabbyPete wrote: > I am loosing the django session. try setting the P3P on response: response['P3P:CP'] = "IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT" it probably wont help but it fixes this issue with explorer so it

Re: Facebook session problems.

2011-01-30 Thread Aljoša Mohorović
On Sun, Jan 30, 2011 at 6:30 AM, CrabbyPete wrote: > I log in and all is good except I loose the session if I go to another > web site and come back. if this is facebook canvas app it wont work properly in safari and explorer because of some iframe restrictions. is this

Re: tinymce

2010-12-17 Thread Aljoša Mohorović
On Fri, Dec 17, 2010 at 3:27 PM, alecx wrote: > I integrated django-tinymce into my application. Now I can edit the > text in the former textarea field. > But when I submit the form, the field is empty. > I am not able to figure out why the text I wrote in

Re: Django-Facebook (yet another thread)

2010-12-14 Thread Aljoša Mohorović
first step is to setup your fb canvas app to use oauth 2.0 - http://developers.facebook.com/docs/authentication/canvas howto ask use to authorize your app? you need to point user to proper url - http://developers.facebook.com/docs/authentication/#authenticating-users-in-a-web-application this

custom form based on user in admin

2010-12-02 Thread Aljoša Mohorović
is this the best way to use different forms for users in admin app? = class MyModelForm: ... class RootMyModelForm: ... class MyModelAdmin(admin.ModelAdmin): form = MyModelForm def get_form(self, request, obj=None, **kwargs):

Client#post returns None for response

2010-09-27 Thread Aljoša Mohorović
i'm trying to test post request using Client from django.test.client (v1.1.2) but it returns None for response. target url is a django-piston resource and i can test it normally from django shell: >>> h.request(url, "POST", urlencode(data)) # h is httplib2.Http object but when i try to use

Re: Launching Background Processes from a View

2010-09-06 Thread Aljoša Mohorović
On Mon, Sep 6, 2010 at 7:19 AM, Heath wrote: > What I require seems simple, just run the requested process in the > background. The terminal equivalent would be: > > "nohup &" and return control to the view. > > Any ideas on how to achieve this? if this already works in a

how do forms select language to render?

2010-09-05 Thread Aljoša Mohorović
if django.utils.translation.get_language() and LANGUAGE_CODE returns one language what does form.as_p use that it renders localized stuff in another language? Aljosa Mohorovic -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Image and thumbnal solution

2010-08-12 Thread Aljoša Mohorović
On Wed, Aug 11, 2010 at 9:40 PM, Franklin Einspruch wrote: > I still don't get this. Are you supposed to do something like... > > image = models.ImageField() > image.height_field = 'height' > image.width_field = 'width' > > And make 'height' and 'width' columns in

Re: pyfacebook

2010-08-12 Thread Aljoša Mohorović
On Thu, Aug 12, 2010 at 1:34 AM, Alessandro Ronchi wrote: > Is pyfacebook compatible with django 1.2.1? I didn't find nothing, and > it gives me a 403 error I cannot understand: pyfacebook is no longer actively developed, try http://github.com/facebook/python-sdk

Re: Image and thumbnal solution

2010-08-11 Thread Aljoša Mohorović
On Wed, Aug 11, 2010 at 2:26 PM, zero00 wrote: > I get it now thanks no problem, glad i could 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-us...@googlegroups.com. To

Re: Image and thumbnal solution

2010-08-11 Thread Aljoša Mohorović
On Wed, Aug 11, 2010 at 2:02 PM, zero00 wrote: > Im testing various things right now and i narrow the problem to this: > >  height_field=150, width_field=150 > > thumb = models.ImageField(upload_to="images/services/thumbs", > height_field=150, width_field=150) > > those

Re: Image and thumbnal solution

2010-08-11 Thread Aljoša Mohorović
> image = models.ImageModel(upload_to"image_path") is this copy/paste error or did you forget "=" for upload_to? Aljosa Mohorovic -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Django images, can't load a simple image into html page when I using django!

2010-08-11 Thread Aljoša Mohorović
On Wed, Aug 11, 2010 at 1:14 PM, pj-linden wrote: > I have yust started with a django project and have the default settup, > I have followed the django tutorials and now I am trying to load an > image into the html page that i have created but for some reason the > image

Re: Image and thumbnal solution

2010-08-11 Thread Aljoša Mohorović
On Wed, Aug 11, 2010 at 1:00 PM, zero00 wrote: > I tried the most simple way: > > class Model(models.Model): >   thumbnail = models.ImageModel(upload_to="thumb_path" height=100, > width=100) >   image = models.ImageModel(upload_to"image_path") > > but apparently the default

Re: Problem with cache.

2010-08-11 Thread Aljoša Mohorović
On Wed, Aug 11, 2010 at 12:27 PM, Felipe wrote: > The number 487.000 for example, that would stay the same value for all > the time is changing with a certain frequency when django consult it's > cache in /var/tmp/djangocache and the value showed is 287.000. > > The cache

Re: Problem with cache.

2010-08-10 Thread Aljoša Mohorović
On Tue, Aug 10, 2010 at 7:17 PM, Felipe wrote: > So, > > I'm using a filesystem caching and I'm using cache.get and cache.set > to set and get the cache. > > But sometimes django shows a different value of the stored value in > the database. cache is not updated

Re: Problem with cache.

2010-08-10 Thread Aljoša Mohorović
On Tue, Aug 10, 2010 at 6:55 PM, Felipe wrote: > So, when I erase the cache, the value is corrected, and the variable > turns showing the real value which is stored in the database. what do you mean when you say cache? browser cache, memcached or something else? > Could