Escaping or Unescaping Translations in Templates

2008-08-29 Thread Aidas Bendoraitis
Hello all! How to control the escaping of translations in templates? For example, {% trans "I & Co" %} should be escaped in html templates but not in javascript (or other language) templates. Aidas Bendoraitis aka Archatas --~--~-~--~~~---~--~~ You

Clean URL Design: List Views and Details Views

2009-04-16 Thread Aidas Bendoraitis
Hello, Recently, we are solving a conceptual question of designing clean urls for list and detail views of objects with slugs. Let's say we have products with their slugs. In the naive way, the list view could be accessed by /products/ and the detail views could be accessed by /products/

Site structure and navigation

2009-05-06 Thread Aidas Bendoraitis
different models laying under each of them. Regards, Aidas Bendoraitis --~--~-~--~~~---~--~~ 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 u

Design question: User vs. UserProfile

2009-09-18 Thread Aidas Bendoraitis
e the AUTH_PROFILE_MODULE at any time. And with the second one you could change the authentication mechanism easier or allow records of people without Users. What do you usually choose? Kind regards, Aidas Bendoraitis --~--~-~--~~~---~--~~ You received this message because yo

Re: Simple Template Dict Problem

2007-06-18 Thread Aidas Bendoraitis
Hello Trey! You can iterate by the entries of a dictionary, using this: {% for i in d.items %} {{ i.0 }}: {{ i.1 }} {% endfor %} Regards, Aidas Bendoraitis aka Archatas On 6/7/07, Trey <[EMAIL PROTECTED]> wrote: > > Thanks Russ, I think my answer for today is three dimen

Re: Using Ajax to edit my admin page

2007-06-18 Thread Aidas Bendoraitis
plate tag which would return a complex array structure with manufacturers and corresponding collections. Regards, Aidas Bendoraitis aka Archatas On 6/7/07, Greg <[EMAIL PROTECTED]> wrote: > > I'm building a site where I'm going to have 10 manufacturers and each > of t

Re: classes

2007-06-18 Thread Aidas Bendoraitis
or type() On 6/7/07, Joseph Heck <[EMAIL PROTECTED]> wrote: > > .__class__ > > On 6/7/07, Lic. José M. Rodriguez Bacallao <[EMAIL PROTECTED]> wrote: > > how can I know insede a method the type of my class dynamicaly? > > > > -- > > Lic. José M. Rodriguez Bacallao > > Cupet > > > > > > > > > --~

Re: classes

2007-06-21 Thread Aidas Bendoraitis
Actually, type is a function, not a method. type(x) == x.__class__ Regards, Aidas Bendoraitis aka Archatas On 6/18/07, Joseph Heck <[EMAIL PROTECTED]> wrote: > > x = '123' > x.__class__ will give a reasonable answer, x.type() doesn't. (Python 2.4) > >

Re: How reliable is using Ajax?

2007-06-21 Thread Aidas Bendoraitis
as stable as you make it, as well as any other technologies. Regards, Aidas Bendoraitis aka Archatas On 6/11/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I have been tinkering with Ajax today, based on this tutorial: > http://www.b-list.org/weblog/2006/07/31/django-tips-simp

Re: using recaptcha with django's contrib comments module

2007-06-25 Thread Aidas Bendoraitis
the world, but it works. Regards, Aidas Bendoraitis aka Archatas On 6/23/07, Eric St-Jean <[EMAIL PROTECTED]> wrote: > > Hi, > > Short form of my question: i have a custom view which does some work and > then calls django.contrib.comments.views.comments.post_free_comment;

Re: How to put an asterisk next to the required form fields?

2007-06-25 Thread Aidas Bendoraitis
For the oldforms, it should be like this: {%for field in form%} {{ field.label }} {{ field }}{%if field.formfield.is_required %}*{%endif%} {%endfor%} tag is deprecated. DO NOT use it. Use CSS. Regards, Aidas Bendoraitis aka Archatas On 6/25/07, EL AATIFI Sidi

Re: Send a filter-pipline output to a template tag

2007-06-26 Thread Aidas Bendoraitis
Use the {% with %} template tag for that: {% with variable|some_filter as some_list %} {% for el in some_list %} {% do_something el %} {% endfor %} {% endwith %} Regards, Aidas Bendoraitis aka Archatas On 6/25/07, Manuel Meyer <[EMAIL PROTECTED]> wrote: > > -BEGI

Re: augmenting admin delete

2007-07-04 Thread Aidas Bendoraitis
Use Django pre_delete and post_delete signals: http://www.mercurytide.co.uk/whitepapers/django-signals/ or override the delete method: def delete(self): # do something super(type(self), self).delete() # do something Regards, Aidas Bendoraitis aka Archatas On 7/3/07, Bryan <[EM

Re: function to generate choices list

2007-07-08 Thread Aidas Bendoraitis
I think, the problem would be solved if you assigned a class overriding list instead of a preformed list to the choices. Check XFieldList for a living example: http://www.djangosnippets.org/snippets/51/ Regards, Aidas Bendoraitis aka Archatas On 7/6/07, David Reynolds <[EMAIL PROTEC

Re: Djangonauts at EuroPython?

2007-07-08 Thread Aidas Bendoraitis
I don't participate in the EuroPython this year, but have fun in the capital of my native country :) Regards, Aidas Bendoraitis aka Archatas (from Berlin, Germany) On 7/8/07, Ville Säävuori <[EMAIL PROTECTED]> wrote: > > > Simon Willison is keynoting, and he is an origina

Re: about django-admin settings

2007-07-08 Thread Aidas Bendoraitis
Set the environment variable PYTHONPATH to the parent directory of the mysite. That should help you. Regards, Aidas Bendoraitis aka Archatas On 7/9/07, jujian <[EMAIL PROTECTED]> wrote: > > HELP! > > > > > --~--~-~--~~~---~--~

Re: DRY violation

2007-07-11 Thread Aidas Bendoraitis
# ... assign the user to the instance if it has the created_by field ... dispatcher.connect(attach_user_to_object, signal=signals.pre_save) Regards, Aidas Bendoraitis On 7/11/07, Norjee <[EMAIL PROTECTED]> wrote: > > Use the events framework. I'm sure there is a pre-save e

Re: Multiple Edit

2007-08-16 Thread Aidas Bendoraitis
Christopher, In your case, I would create a custom view/form extending the templates of admin and would set the url of that view to something like r'^/admin/obj_list/$'. Regards, Aidas Bendoraitis [aka Archatas] On 7/21/07, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > &

Re: Can Django be combined with a more powerful ORM?

2007-08-20 Thread Aidas Bendoraitis
tribute, 0) setattr(self, attribute, current_value + by_value) self.save() Good luck! Aidas Bendoraitis [aka Archatas] On 8/20/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Mon, 2007-08-20 at 15:48 +0200, Stefan Matthias Aust wrote: > [...] > > I'd li

Re: Importing Excel/CVS into Database

2007-08-21 Thread Aidas Bendoraitis
reader = csv.reader(line_list, delimiter=";", doublequote=True) for value_list in reader: function(value_list) >>> read_excel_csv("/some/path/table.csv", test) ### Good luck! Aidas Bendoraitis aka Archatas On 8/21/07, olivier <[EMAIL PROTECTED]>

Re: How to pass an extra variable to every template?

2007-08-23 Thread Aidas Bendoraitis
quot;, "django.core.context_processors.request", "yourproject.yourapp.context_processors.general", ) >From now on {{ root_dir }} and {{ media_url }} will be accessible in all templates. Good luck! Aidas Bendoraitis [aka Archatas] On 8/23/07, Filipe Correia <[EMAIL PROT

Re: using defaultdict on django

2007-09-03 Thread Aidas Bendoraitis
keys and values Regards, Aidas Bendoraitis aka Archatas On 8/25/07, james_027 <[EMAIL PROTECTED]> wrote: > > Hi, > > Anybody has an idea about this? > > Thanks > james > > On Aug 24, 3:27 pm, james_027 <[EMAIL PROTECTED]> wrote: > > hi, > > >

Reusable models?

2008-05-21 Thread Aidas Bendoraitis
tices for reusing models? Regards, Aidas Bendoraitis [aka Archatas] --~--~-~--~~~---~--~~ 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

Re: Reusable models?

2008-05-22 Thread Aidas Bendoraitis
Your suggestions are welcome. Aidas Bendoraitis [aka Archatas] --~--~-~--~~~---~--~~ 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

Re: sorting in model

2007-02-19 Thread Aidas Bendoraitis
You can't order by a property of a model, but you can do that by the field of the related model: Film.objects.select_related().order_by('appname_product.name') Documentation: http://www.djangoproject.com/documentation/db_api/#order-by-fields Regards, Aidas Bendoraitis [aka Arch

Re: Seeking best-practices: modular site hosting multiple URLs

2007-02-23 Thread Aidas Bendoraitis
What you need in my opinion is just one django project with multiple settings files (for each domain). Regards, Aidas Bendoraitis [aka Archatas] On 2/21/07, Sundial Services <[EMAIL PROTECTED]> wrote: > > I would like to find references to "best practices" regarding t

Re: Search feature

2007-02-23 Thread Aidas Bendoraitis
cts.filter(*flatpage_args, **flatpage_kwargs) product_args = ... # OR'ed arguments product_kwargs = ... # arguments to AND products = Product.objects.filter(*product_args, **product_kwargs) Regards, Aidas Bendoraitis [aka Archatas] On 2/22/07, Mary <[EMAIL PROTECTED]> wrote: >

Re: where is the code for the date widget in admin

2007-02-27 Thread Aidas Bendoraitis
like FireBug for Firefox (or at least use "view source"). Good luck! Aidas Bendoraitis [aka Archatas] On 2/24/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Sat, 2007-02-24 at 13:13 +0530, Kenneth Gonsalves wrote: > > > > On 24-Feb-07, at 12:22 PM, oggie r

Re: database field

2007-02-27 Thread Aidas Bendoraitis
I think, overriding the admin template for specific application would be the most straightforward solution: * create a template in your template dir admin/yourapp/change_form.html * show some field there only if request.user has some permissions. Regards, Aidas Bendoraitis [aka Archatas] On 2

Re: Django apps

2007-03-01 Thread Aidas Bendoraitis
Have a look here: http://code.djangoproject.com/wiki/DjangoResources#ExampleDjangoapplicationswithsourcecodetemplates Regards, Aidas Bendoraitis [aka Archatas] On 2/28/07, Alessandro Ronchi <[EMAIL PROTECTED]> wrote: > > Is there any place where I can find django based apps? >

Re: selecting site from hostname in URL

2007-03-01 Thread Aidas Bendoraitis
parse the URL and and get appropriate content according the subdomain. Regards, Aidas Bendoraitis [aka Archatas] On 3/1/07, Doug Van Horn <[EMAIL PROTECTED]> wrote: > > On Feb 28, 6:33 pm, Michael Cuddy <[EMAIL PROTECTED]> wrote: > > > > Any ideas? > > -- > &g

Development in LAN. URLs of FlatPages. Best Practices?

2007-03-05 Thread Aidas Bendoraitis
ther under local domain names (i.e. http://example.local/). 3. creating some middleware that removes directory name from the requested URL before URL parsing. What are the best practices for doing that? What do you do in similar situations? Regards, Aidas Bendoraitis [ak

Re: Recursion in templates... again

2007-03-05 Thread Aidas Bendoraitis
%} {{ item }} {% menu item %} {% endfor %} {% endif %} Regards, Aidas Bendoraitis [aka Archatas] On 3/5/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Mon, 2007-03-05 at 10:31 +0100, Jens Diemer wrote: > > Chris Moffitt schrieb: > > > I've implemented a s

Re: creating a website log

2007-03-05 Thread Aidas Bendoraitis
Maybe this could help you: http://www.djangosnippets.org/snippets/16/ Regards, Aidas Bendoraitis [aka Archatas] On 3/3/07, Patrick <[EMAIL PROTECTED]> wrote: > > Hi, I'd like to create a website log, similar to the log found in > django.contrib.admin and was wondering i

Re: Outputting navigation

2007-03-05 Thread Aidas Bendoraitis
ndfor %} {% endfor %} Regards, Aidas Bendoraitis [aka Archatas] On 3/5/07, Mike H <[EMAIL PROTECTED]> wrote: > > > Hi all, > > I have a list of wiki pages, each one has a category. > > I want to output them in a list, grouped by category. > > So far I am looping thr

Re: can I mimic authenticated user from shell?

2007-03-06 Thread Aidas Bendoraitis
Can't help you much with this, but according to the docs (http://www.djangoproject.com/documentation/authentication/#methods), "is_authenticated() -- Always returns True" for User model and it returns False for AnonymousUser model. Regards, Aidas Bendoraitis [aka Archat

Signals for User model

2007-03-07 Thread Aidas Bendoraitis
modify the contributed models and the code was read and executed when the user is saved? Regards, Aidas Bendoraitis [aka Archatas] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to th

Re: Signals for User model

2007-03-07 Thread Aidas Bendoraitis
mind is: How to attach an attribute, property or method to an existing Python class? Any examples or directions? Regards, Aidas Bendoraitis [aka Archatas] On 3/7/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Wed, 2007-03-07 at 11:58 +0100, Aidas Bendoraitis wrote: > &g

Re: Admin interface

2007-03-08 Thread Aidas Bendoraitis
Either override templates for specific models or use javascript (js property of the Admin class) to change the fields. I think that it will be also possible to change the field type with the newforms admin. Reference: http://www.djangosnippets.org/snippets/35/ Good luck! Aidas Bendoraitis [aka

Re: howto add join table field?

2007-03-09 Thread Aidas Bendoraitis
= model.ForeignKey(Item) itemlist = model.ForeignKey(ItemList) You won't be able to use the default admin widget for Many to many selection (at least without some template ant javascript hacking), but you'll have what you want. Regards, Aidas Bendoraitis [aka Archatas] On 3/9/07, akon

Re: High Fidelity Slugify : support for international characters

2007-03-12 Thread Aidas Bendoraitis
(maybe better) as an extension suggestion for http://www.djangosnippets.org/snippets/98/ Regards, Aidas Bendoraitis [aka Archatas] On 3/12/07, Sam <[EMAIL PROTECTED]> wrote: > > I needed slugify to be more precise with accented characters and i > couldn't find some code to

Re: why does django display th/td:hover style incorrectly ?

2007-03-14 Thread Aidas Bendoraitis
I'm not sure about IE7, but all the previous versions of IE certainly didn't support hover for other html tags than . So it is not Django issue at all. If you need some browser specific special effects, use javascript for IE. Regards, Aidas Bendoraitis [aka Archatas] On 3/14/07, Ou

Checking whether an app is installed?

2007-03-14 Thread Aidas Bendoraitis
Hello, Djangoers! Is there a function for checking whether an app was installed in the current project? I have a custom index.html template for contributed administration and I need to check whether to show some links or not. Regards, Aidas Bendoraitis [aka Archatas

Re: Checking whether an app is installed?

2007-03-14 Thread Aidas Bendoraitis
. show links to administration lists ... {% endif %} But thanks, anyway. Regards, Aidas Bendoraitis [aka Archatas] On 3/14/07, James Bennett <[EMAIL PROTECTED]> wrote: > > On 3/14/07, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote: > > Is there a function for checking whether

Subversion: How do you set up multiple branches of the same project on the same machine?

2007-03-19 Thread Aidas Bendoraitis
in that case I won't be able to merge the branch back to the project, will I? How do you solve problems like that, or how could I deal with it instead of renaming the project? Regards, Aidas Bendoraitis [aka Archatas] --~--~-~--~~~---~--~~ You received

Re: Subversion: How do you set up multiple branches of the same project on the same machine?

2007-03-19 Thread Aidas Bendoraitis
-permission branch. They are like one project at different statuses and at some point they'll need to be merged (at least some parts of them). Both someproject and someproject2 are self-contained projects. No other project uses any part of them. Regards, Aidas Bendoraitis [aka Archatas] On 3/

Re: SESSION_EXPIRE

2007-03-19 Thread Aidas Bendoraitis
Two things, that might be the cause of your problem: a) Have you restarted your browser or at least removed settings.pyc after the changes? b) If you use Mac OS and you close the window of your browser, the browser itself isn't closed. Press Cmd+Q to close the browser completely. Regards,

Re: Subversion: How do you set up multiple branches of the same project on the same machine?

2007-03-20 Thread Aidas Bendoraitis
" SetEnv DJANGO_SETTINGS_MODULE someproject.settings PythonDebug On PythonAutoReload On PythonInterpreter someproject2 I also symlink media directories respectively to someproject-media and someproject2-media in Apache htdocs. Anyway, thanks, Scott, for your help as well.

Re: Development in LAN. URLs of FlatPages. Best Practices?

2007-03-20 Thread Aidas Bendoraitis
ether you're talking about models, views, middleware, or something else from the flatpages. Anyway, it's enough to write your own middleware to override the default control of the flatpages (And fortunately it is not hard to do that). Regards, Aidas Bendoraitis [aka Archatas] > >

Re: Blocking IP with middleware?

2007-03-21 Thread Aidas Bendoraitis
Check the request.META['REMOTE_ADDR'] in your custom request middleware. If it equals to the one, you want to block, return an error page. Regards, Aidas Bendoraitis [aka Archatas] On 3/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Looking at my logs, I saw a g

Re: Development in LAN. URLs of FlatPages. Best Practices?

2007-03-21 Thread Aidas Bendoraitis
Ashwoods, I did also some other business-related modifications so it would take me some time to prepare that just for a snippet. That middleware is not worth making it a snippet. I would better suggest you to use the solution by Derek. Regards, Aidas Bendoraitis [aka Archatas] On 3/21/07

Re: Always repeating myself in templates

2007-03-22 Thread Aidas Bendoraitis
Then instead of {{ object.whatever.whatever.property }}, you can use {{ object.get_related_property }} and even if you do that multiple times, the database is accessed only at the first time of accessing the method. Regards Aidas Bendoraitis aka Archatas On 3/22/07, akonsu <[EMAIL PROTECTED]> wrote: > > hello, > &g

Re: adding to User class

2007-03-22 Thread Aidas Bendoraitis
; You can access the custom method like this: user.get_profile().dosomething() Regards, Aidas Bendoraitis [aka Archatas] On 3/22/07, Greg Donald <[EMAIL PROTECTED]> wrote: > > How/where can I add a method to the built-in User class? > > > Thanks, > > >

Re: Django and Routing SUBDOMAIN STYLE URL

2007-03-24 Thread Aidas Bendoraitis
return None My settings variables: ROOT_DIR - either "/" or "/projectname/" depending on how my project is accessed - under some domain directly or in some directory of localhost. SUBDOMAINS_SUPPORTED - Are subdomains supported on that server? True/False SUBDOMAIN_MN

Python-specific question: variable scope

2007-03-30 Thread Aidas Bendoraitis
module a.py in the module b.py? What would be the functions/statements to make it possible? Or in general, how to access the locals of the importing ( not imported!!!) module? Regards, Aidas Bendoraitis --~--~-~--~~~---~--~~ You received this message because you are

Re: Python-specific question: variable scope

2007-03-30 Thread Aidas Bendoraitis
se it with the context of the current one, like include statement in PHP? If there are no ways to do that, then I will just use some workarounds. At first, I am interested about possibilities. Regards, Aidas Bendoraitis aka Archatas On 3/30/07, Forest Bond <[EMAIL PROTECTED]> wrote: > O

Re: Python-specific question: variable scope

2007-03-30 Thread Aidas Bendoraitis
e is a blackbox to me def get_the_x_of_the_module_which_is_importing_me(): return #??? Regards, Aidas Bendoraitis [aka Archatas] P.S. If I am not understandable because of "strange" English, it might be that I need some coffee or sleep. :) On 3/30/07, Rubic <[EMAIL PROTECTED]> wrote: > > b.py: > -

Re: Python-specific question: variable scope

2007-03-30 Thread Aidas Bendoraitis
It's not strongly related to some specific problem, but more to the better python perception and self-training. Thank you all for your time and attention. Thank you, Jerremy D, for the interesting solutions. Regards, Aidas Bendoraitis [aka Archatas] On 3/31/07, Forest Bond <[EMAIL P

Re: Differentiate addition or change during post_save signal

2007-04-04 Thread Aidas Bendoraitis
You can have a pre_save signal for adding property instance._is_new=True if the instance has no id. And then to delete that property in the post_save signal after checking it. Regards, Aidas Bendoraitis [aka Archatas] On 4/4/07, David Larlet <[EMAIL PROTECTED]> wrote: > > Hi, >

Re: Using a ForeignKey in ordering

2007-04-04 Thread Aidas Bendoraitis
te some template tag which reorders items according some conditions and override the change_list.html template for the page model. Regards, Aidas Bendoraitis [aka Archatas] On 4/4/07, James Turnbull <[EMAIL PROTECTED]> wrote: > > Thanks Atilla, > > > There was a simmilar ques

Re: Using a ForeignKey in ordering

2007-04-04 Thread Aidas Bendoraitis
correcting myself: a) Page.objects.order_by('menuitem__name') --> Page.objects.select_related().order_by('menu_menuitem.name') Regards, Aidas Bendoraitis [aka Archatas] On 4/4/07, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote: > As far as I know, current

Per-object-permission branch and Many-to-many relationship issue

2007-04-04 Thread Aidas Bendoraitis
e circumventing of the problem, that is, how could I get all the categories for the Element instance? By the way, I tried to import models both: using project name and not using it. The results are the same. I am using MySQL if it may matter. Has anybody experienced the problem using the

Re: Hacking admin changes

2007-04-04 Thread Aidas Bendoraitis
I would have written a request_middleware instead of what you did. I think, it would be cleaner. Regards, Aidas Bendoraitis [aka Archatas] On 4/4/07, Enrico <[EMAIL PROTECTED]> wrote: > > Can't you just override the 'save' method of your model? > > Or may

Re: Per-object-permission branch and Many-to-many relationship issue

2007-04-05 Thread Aidas Bendoraitis
where=['categoryapp_category.id=eec.category_id', 'eec.element_id=%d' % (self.id or 0)], ) Now I can use e.get_categories() instead of e.categories.all() and get the related objects without errors. Regards, Aidas Bendoraitis [aka Archatas] On 4/4/07, Aidas Bendoraitis <[EMAIL PRO

Re: django sendmail

2007-04-26 Thread Aidas Bendoraitis
Set some EMAIL_HOST, EMAIL_HOST_USER, and EMAIL_HOST_PASSWORD in your settings. That might help you. Regards, Aidas Bendoraitis aka Archatas On 4/26/07, arv43 <[EMAIL PROTECTED]> wrote: > > hello, > i get a 550, relay not permitted error when i try to use send_mail. > th

Re: Dev Server - Being Denied Admin Media

2007-05-08 Thread Aidas Bendoraitis
Bryan, If this happens when using django integrated dev server, then setting ADMIN_MEDIA_PREFIX to something different than MEDIA_URL should help you, for example: "admin-media". I consider this a bug of Django, which perhaps appear only under some specific conditions. Aidas Bendor

Re: Translation of class names

2007-05-10 Thread Aidas Bendoraitis
Maybe you are calling make-messages from the wrong directory, or Russian is not in the LANGUAGES? Regards, Aidas Bendoraitis aka Archatas On 5/8/07, Pashka R. <[EMAIL PROTECTED]> wrote: > 2007/5/7, Konstantin Pavlovsky <[EMAIL PROTECTED]>: > > > > up! > > nobod

Re: excel import

2007-05-14 Thread Aidas Bendoraitis
to the record of the main item. All the further details depend on your models and business requirements. Regards, Aidas Bendoraitis aka Archatas On 5/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hello, everyone! > > I want to implement some sort of importing data int

Re: Tricky context question

2007-05-15 Thread Aidas Bendoraitis
This should help you to solve almost all your multilingual problems: http://www.djangosnippets.org/snippets/51/ Regards, Aidas Bendoraitis aka Archatas On 5/15/07, Wolfram Kriesing <[EMAIL PROTECTED]> wrote: > > I have a bi-language (english and german) site. I try to hide the >

Re: nested dictionaries in templates

2007-05-17 Thread Aidas Bendoraitis
except: return None register.filter('dict_value', dict_value) ... or you can go through the items like this: {% for key_value in dictionary.items %} {{ key_value.0 }}{# the key #} {% for item in key_value.1 %}{# the value, that is the queryset #} {{ item }} {% endfor %}

Re: Securing static files

2007-05-18 Thread Aidas Bendoraitis
The most secure way, in my opinion, is to keep the files in a directory which is not accessible via the webserver and write a wrapper view, which would return the static files if the user within the current session has appropriate permissions. Regards, Aidas Bendoraitis aka Archatas On 5/18

Re: {{ perms }} seems to be empty

2007-05-23 Thread Aidas Bendoraitis
Is "django.core.context_processors.auth" set in your TEMPLATE_CONTEXT_PROCESSORS? Are those new custom permissions in the auth_permission table? If not - try to delete the test tables and syncdb again. Regards, Aidas Bendoraitis aka Archatas On 5/23/07, Michael Lake <[EMAIL PROT

Re: How do I pull a javascript array into a form submission

2007-09-18 Thread Aidas Bendoraitis
some field which holds the number of dynamically created input fields. Whenever a user submits the form, you check the number of dynamically created fields and create a form with the number of those dynamic fields. Regards, Aidas Bendoraitis [aka Archatas] On 9/4/07, eriku777 <[EMAIL PROTECTED

Backwards relationship doesn't work on one of the development machines

2007-09-18 Thread Aidas Bendoraitis
Regards, Aidas Bendoraitis [aka Archatas] --~--~-~--~~~---~--~~ 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 g

Re: The setlang view

2007-09-24 Thread Aidas Bendoraitis
Or you can have a form with an for each language. Regards, Aidas Bendoraitis [aka Archatas] On 9/24/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Sun, 2007-09-23 at 18:13 +0100, Chris Hoeppner wrote: > [...] > > Seems pretty silly to me. I know that any request

Re: ManytoMany uploading.

2006-09-21 Thread Aidas Bendoraitis
ython IDE: python manage.py shell Good luck! Aidas Bendoraitis [aka Archatas] On 9/21/06, Gabriel Puliatti <[EMAIL PROTECTED]> wrote: > Hey, I'm trying to write a manytomany into the database. I have created > the form correctly, using {{ form.courses }}, and I can upload > every

Re: seeking clarification: custom manipulator foreign key / many-to-many

2006-09-21 Thread Aidas Bendoraitis
. Good luck! Aidas Bendoraitis [aka Archatas] On 9/20/06, patrickk <[EMAIL PROTECTED]> wrote: > > > Am 20.09.2006 um 21:40 schrieb Ivan Sagalaev: > > > > > patrickk wrote: > >> thanks. the data is sent now, but > >> - how do I save

Re: two models -> one form -> addmanipulator

2006-09-22 Thread Aidas Bendoraitis
or or this approach. Good luck! Aidas Bendoraitis [aka Archatas] On 9/22/06, Michael Radziej <[EMAIL PROTECTED]> wrote: > > limodou schrieb: > > No, I think you cann't do this in django. You should use custom > > manipulator for this. > > Hmm, I thin

Re: HTTP response-code for missing querystring?

2006-09-22 Thread Aidas Bendoraitis
Why not to return a custom notice without any error codes? If you still want to send a response error, I would choose from these depending on the situation, what you are implementing: 204 No Content 400 Bad Request 403 Forbidden Aidas Bendoraitis [aka Archatas] On 9/22/06

Re: My Ratings System

2006-10-02 Thread Aidas Bendoraitis
following functions will be helpful for you: ct = ContentType.objects.get_for_model(SomeModel) my_record = ct.get_object_for_this_type (pk=object_id) Good luck! Aidas Bendoraitis [aka Archatas] On 9/24/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I went through GenericRelatio

Admin templates: Fields of the Related object

2006-10-05 Thread Aidas Bendoraitis
that data. But I will only go to that direction if the way, I am asking about, fails. Any hints? regards, Aidas Bendoraitis [aka Archatas] [URL #1] http://code.djangoproject.com/wiki/NewAdminChanges#Adminconvertedtoseparatetemplates [URL #2] http://www.b-list.org/weblog/2006/06/06/django

Re: How do I work out what the Web root is?

2006-10-09 Thread Aidas Bendoraitis
Anyway, you can find the location of your django project files with the following (if this is what you really need): import os DIRNAME = os.path.dirname(__file__) Good luck! Aidas Bendoraitis [aka Archatas] On 10/9/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Sun, 2006

Re: comment framework: lookup question

2006-10-09 Thread Aidas Bendoraitis
t its comments into one comment list, then to sort that comment list in Python level according the creation date, and lastly return only the first ten comments to the response. Good luck! Aidas Bendoraitis [aka Archatas] On 10/9/06, patrickk <[EMAIL PROTECTED]> wrote: > > some more detail

Re: Joining Foreign Keys

2006-10-10 Thread Aidas Bendoraitis
t "word", so you should write: p = ProductWord.objects.filter(fk_word__value='haddock') And yes, it is many-to-many relationship between Product and Word. Regards, Aidas Bendoraitis [aka Archatas] --~--~-~--~~~---~--~~ You received this message b

limit_choices_to according the field of the current model?

2006-10-16 Thread Aidas Bendoraitis
known to the system), I'd like that the administrator would see only the parent categories of the chosen vocabulary in the select list. Regards, Aidas Bendoraitis [aka Archatas] --~--~-~--~~~---~--~~ You received this message because you are subscribed to t

Re: ManyToMany Relation and the Admin interface

2006-10-18 Thread Aidas Bendoraitis
By default, all fields are obligatory. You have to set categories = models.ManyToManyField('self', blank=True) to escape from that problem. Good luck! Aidas Bendoraitis [aka Archatas] On 10/18/06, Lutz Steinborn <[EMAIL PROTECTED]> wrote: > > Hello, > > I&

Re: "Pool" of "one" connection in Apache

2006-10-18 Thread Aidas Bendoraitis
I think, you should post this email to django-developers instead of django-users... Or perhaps to post a new ticket at http://code.djangoproject.com/newticket Regards, Aidas Bendoraitis [aka Archatas] On 10/18/06, Rafael SDM Sierra <[EMAIL PROTECTED]> wrote: > Lo

Re: ManyToMany versus creating two one-to-many relationships.

2006-10-20 Thread Aidas Bendoraitis
edit B as inline for A and select C's there from a drop-down list. I hope all I've written is understandable. Now you can try creating models and set different settings and see the pros and cons yourself.Good luck!Aidas Bendoraitis [aka Archatas] On 10/20/06, MerMer <[EMAIL PROTECTED]&

Re: ManyToMany versus creating two one-to-many relationships.

2006-10-20 Thread Aidas Bendoraitis
You have to define table B as a model and to set it a class Admin. It is impossible to edit the intermediate table, created from standard ManyToManyField, as a separate model in Django.To sum up, you must have all tables A, B, and C, defined as different models. Good luck!Aidas Bendoraitis [aka

Passing model instance to the validator

2006-10-27 Thread Aidas Bendoraitis
, whether the object is newly created or edited. (By the way, I am using per object permission branch) Regards, Aidas Bendoraitis [aka Archatas] [URL #1] http://groups.google.de/group/django-users/browse_frm/thread/6a3686f48d2c70fa --~--~-~--~~~---~--~~ You received

Re: "first_name" -> "First Name"

2006-10-30 Thread Aidas Bendoraitis
There is a function get_verbose_name in the file django/db/models/options.py, which does the conversion. If you need just to change the verbose_name, don't forget that there are meta attributes verbose_name and verbose_name_plural for that reason. Good luck! Aidas Bendoraitis [aka Arc

Re: DateTimeField - Value Error - 'Year is out of Range'

2006-10-30 Thread Aidas Bendoraitis
I have recently had the same problem, but I solved it adding null=True to the DateTimeField. Good luck! Aidas Bendoraitis aka Archatas On 10/30/06, Merric Mercer <[EMAIL PROTECTED]> wrote: > > I'm am having a problem with the DateTimeField when I save the data > throu

Re: DateTime error

2006-10-30 Thread Aidas Bendoraitis
It is possible, that the clock on the server is set differently than the clock on your local machine. Have you checked that? Good luck! Aidas Bendoraitis aka Archatas On 10/26/06, 张沈鹏 <[EMAIL PROTECTED]> wrote: > > I set > > TIME_ZONE = 'CCT' > (in China) >

Re: captcha problem

2006-10-31 Thread Aidas Bendoraitis
Maybe your captcha template tag is not loaded? Did you put it in the right place? Regards, Aidas Bendoraitis aka Archatas On 10/31/06, Grigory Fateyev <[EMAIL PROTECTED]> wrote: > > Hello Grigory Fateyev! > On Mon, 30 Oct 2006 21:30:01 +0300 you wrote: > > > Why it c

Re: Changing admin template for only certain models

2006-11-01 Thread Aidas Bendoraitis
ly include different custom template tag instead of {% result_list cl %} in change_list.html As you see, the contributed administration is not flexible enough, but some creativity can solve many problems. Good luck! Aidas Bendoraitis [aka Archatas] On 11/1/06, iain duncan <[EMAIL PROTECTED]> w

Re: how are you handling i18n and m10l content?

2006-11-08 Thread Aidas Bendoraitis
Some time ago, I also wrote a few thoughts about implementation of multilingual content: http://groups.google.com/group/django-users/browse_frm/thread/13ae7f762d1d5d5e Maybe that will help us to make the final decision. Aidas Bendoraitis [aka Archatas] On 11/8/06, Gonzalo Saavedra <[EM

Re: Django/Javascript string problem

2006-11-08 Thread Aidas Bendoraitis
I think, you could use the addslashes template tag to escape new lines, like: {{ form.embeddedvideo.0.type|addslashes }} And if that doesn't work as expected, in your case, I would write my own template tag for escaping strings. Good luck! Aidas Bendoraitis [aka Archatas] On 11/8/06,

Re: what's the correct way to create object with ForeignKey?

2006-11-08 Thread Aidas Bendoraitis
ubgroup.objects.get(subGroupName="p1sub1") e.save() m = User(name="xxx") m.save() e.user_set.add(m) Good luck! Aidas Bendoraitis [aka Archatas] On 11/8/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I know this maybe very simple, but I can't fi

Re: Order_by problems

2006-11-08 Thread Aidas Bendoraitis
By the way, if you are still learning Django, I would suggest you to upgrade to 0.95, because it has many API improvements and because at some point old versions won't be supported (this is my guess :) ). Good luck! Aidas Bendoraitis [aka Archatas] On 11/8/06, Mike <[EMAIL PROTECTED

Re: how are you handling i18n and m10l content?

2006-11-08 Thread Aidas Bendoraitis
data which makes the models harder to manage. Regards, Aidas Bendoraitis [aka Archatas] On 11/8/06, fdb <[EMAIL PROTECTED]> wrote: > > I'd like to show you my approach, which I use for one of my clients. > > For every model that needs to have multi-lingual content, you a

  1   2   >