Re: Navigation menu

2011-04-12 Thread Andy Mikhailenko
Hello Daniel, I think you really need to provide your definition of "nicer" to get useful feedback. For instance, my implementation of breadcrumbs[1] indeed introduces a custom template tag and I haven't the slightest idea what are the use cases where this approach would not be natural. [1] http

Re: slugify override

2011-01-08 Thread Andy Mikhailenko
> How can I override slugify function globally? I want to add some other > letters actions especially form my language. You can try django-autoslug for your own code. Existing code can be (?) fixed via monkey-patching but that's not a good idea. -- You received this message because you are subsc

Re: Giving up PHP. ...Can't decide between Django & Rails

2010-04-12 Thread Andy Mikhailenko
Hi, > I'm a little concerned by django error handling. you could try the Werkzeug debugger[1], it really does save time a lot. Or, by the way, you could try Werkzeug without Django, in some cases it's a good idea. There are many good frameworks, I suggest that you pick the language first and then

Re: Dynamic Model

2010-02-11 Thread Andy Mikhailenko
Hi Sameer, > is it possible to build a dynamic model in run-time in version 1.1 ? What do you mean by "dynamic"? If you need to define arbitrary attributes in runtime *and* be able to save them correctly in a RDBMS *and* be able to restore the object from the DB *and* be able to query objects by

Re: GET request breadcrumbs

2010-01-22 Thread Andy Mikhailenko
I would suggest using django-navigation or a similar approach, that is to bind breadcrumbs-related code to views instead of templates. Of course you would still render the breadcrumbs in a template, but that would be a single piece of code (I usually place it right in the project's base.html) which

Re: Best Practice for developing djangoapp in a repository

2010-01-22 Thread Andy Mikhailenko
Why not create a symlink to django-tagging/tagging in the project directory? I think it's the easiest way. -- regards, Andy -- 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 u

Re: How to use French accent on django template?

2009-11-14 Thread Andy Mikhailenko
The problem is not in templates. Probably either a view or a template tag does something wrong to the caption string. If Django hides the traceback, try testing each module separately. The simplest way to evade the "raise wrapped" is to raise an exception right _before_ rendering data prepared by y

Re: Django methodologies and best practices

2009-10-20 Thread Andy Mikhailenko
I usually start with defining goals, actors and use cases, continue with UML class diagrams and UI mockups on paper, and then transfer all that to Python in this order: models, urls, views, templates. Then I manually populate the DB with some data, dump a fixture and periodically reset the app dat

Re: How do I create project independent apps.

2009-10-06 Thread Andy Mikhailenko
Another way is to use a settings wrapper such as django-harness[1], which: * helps organize apps (by name, without the notion of project) and eliminates the need to write absolute paths for templates, sqlite database and such stuff stored in the project directory; * simplifies version control of p

Re: Call a custom python function during each model save

2009-09-02 Thread Andy Mikhailenko
Try signals[1], namely pre_save[2]. I would stick to this way instead of overriding model's save() method. [1] http://docs.djangoproject.com/en/dev/topics/signals/ [2] http://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.signals.pre_save On Sep 1, 4:21 pm, Harish wrote: > Hi Frie

Re: ANN: Django 1.1 released!

2009-07-29 Thread Andy Mikhailenko
Thanks for this excellent software! -- Andy --~--~-~--~~~---~--~~ 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, sen

Re: does anyone have document for django-email-confirmation/

2009-07-26 Thread Andy Mikhailenko
There's a sample project[1] in the github repo. [1] http://github.com/jtauber/django-email-confirmation/tree/master/devproject On Jul 25, 6:35 pm, kk wrote: > Hi, > > Is there any tutorial document about how to use this module? --~--~-~--~~~---~--~~ You received

Re: Slugs, why would you ever need to store one in the database?

2009-07-24 Thread Andy Mikhailenko
Just one more addition to the replies above: there's a number of snippets[1], recipes and packages[2] which introduce purely autogenerated safe (unique and sometimes also non-ascii-friendly) slugs without using admin. Autopopulated slugs, when used in URLs without exposing internal autoincremente

Re: Is Django easy to learn and use for my web project?

2009-06-14 Thread Andy Mikhailenko
Django itself is extremely well documented. Sure there are some 3rd- party applications without proper documentation, but I can't actually recall one. Usually you can just read the code and figure out what it does and how to use it. If you can't, see related code in Django source or related topic

Re: Do you use a skeleton for new django sites?

2009-06-03 Thread Andy Mikhailenko
I used to use a skeleton, but the problem was that I couldn't easily upgrade the already "forked" projects to a newer version of the skeleton; I had to manually backport all changed to each project. The solution I finally adopted is to have a wrapper for site configuration (settings and urls) as

Re: When to use admin, and when not to.

2009-05-27 Thread Andy Mikhailenko
User behaviour can be formalized as actions + objects. Some actions span multiple objects. Admin is a great tool that corresponds the *structure* of data. It allows to view and edit all your base for great justice. Err, all your database for zero cost. Out of the box. Nice! However, "editing an ob

Re: Obfuscate HTML..?

2009-05-25 Thread Andy Mikhailenko
Built-in template tag {% spaceless %) can do a part of work for you (namely, remove the extra whitespace), but to actually obfuscate the code you should either use middleware or make extensive use of JavaScript (e.g. open GMail and try to read the source). However, the idea in general sounds stran

Re: Separate User namespace

2009-05-20 Thread Andy Mikhailenko
What about using emails or openIDs for authentication? These include namespaces per se ;) On May 20, 1:09 am, Timboy wrote: > Initially we will have in the ballpark of 10,000 Private users. Anyone > have an idea on an additional user namespace? > > On May 19, 8:42 am, Aneesh wrote: > > > How ma

Re: Ordering a query by comments connected to model

2009-05-16 Thread Andy Mikhailenko
> Any aggregation over generic relations is currently unsupported, it was > hoped this would make it into 1.1, but unfortunately some of the way SQL > works prevented this (since it requires us to change the underlying Query to > allow support for additional conditions on a join clause). Alex, th

Re: Ordering a query by comments connected to model

2009-05-15 Thread Andy Mikhailenko
> I am but what parameter do I give to Count? My entity model don't have > a comments field it is just connected through the view where I do {% > load comments %}? Immediately after posting my comment I understood that you actually can do that easily: Entry.objects.annotate(cc=Count('comment

Re: Ordering a query by comments connected to model

2009-05-15 Thread Andy Mikhailenko
> I am but what parameter do I give to Count? My entity model don't have > a comments field it is just connected through the view where I do {% > load comments %}? Marlun, despite I can't reply to your question (no idea if sorting by generic relations is possible; would be great to hear a respons

Re: What debugger do you use?

2009-05-14 Thread Andy Mikhailenko
I mostly stick to defensive programming so rarely does the need to debug appear; if it does, I use simple print commands to find the stage on which the data is broken; then I fix the algo or add another assert statement. This enables using Kate (or whatever text editor) + manage.py for everything.

Re: Category list in Django

2009-05-11 Thread Andy Mikhailenko
Hi, > in register dispatcher.connect(pre_save, > signal=model_signals.pre_save, sender=modem) > AttributeError: 'module' object has no attribute 'connect' Looks like it's time to update your Django installation. regards, Andy --~--~-~--~~~---~--~~ You received t

Re: Avatars in comments

2009-05-03 Thread Andy Mikhailenko
The easiest way is probably to use something like django-gravatar[1]. Not only you can avoid writing extra models/views, but your site will also reuse existing avatars for some users because Gravatar utilizes email as use ID. So you'll only have to add one tag to your template: {% for comment in

Re: count the number of times an object / class has been instantiated

2009-04-30 Thread Andy Mikhailenko
Hi, your question does not seem to be related to Django. Anyway: class A: cnt = 0 def __init__(self): A.cnt += 1 If you want to count saved instances of a Django model, use MyModel.objects.count(). Cheers, Andy --~--~-~--~~~---~--~~ You received

Re: Creating sub sections

2009-04-21 Thread Andy Mikhailenko
http://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey class Section(Model): ... parent = models.ForeignKey('self') plus some code to build the string representing the path. On Apr 21, 1:30 pm, Oleg Oltar wrote: > Hi! > I am writing an application - a kind of article manage

Re: Registration

2009-04-20 Thread Andy Mikhailenko
> How should I go about moving the site onto the django platform? Learn Python, then Django. This implies reading lots of documentation and being really interested in the whole thing. Also, you should try to understand your needs before asking questions about how to address them. Do you need just

Re: Problem with adding new columns to existing model.

2009-04-06 Thread Andy Mikhailenko
As Daniel suggested, try tools like django_evolution. With the latter you just do: $ ./manage.py evolve --hint -x This shows the changes to be made (--hint) and executes the migration (-x). That's it, the table structure is now synchronized to the Python class without the "alter table" pain. --~

Re: Performance Issue: ForeignKey will touch database again!

2009-04-03 Thread Andy Mikhailenko
Zeal, the issue in its current state seems to be unrelated to Django. By the way, do you really need to display so many objects on one page? Why not try pagination? Regards, Andy --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Go