Re: Anyone seen following error

2011-04-09 Thread Vasil Vangelovski
It's a validation error for a DateTimeField

On 4/10/11 12:28 AM, ydjango wrote:
> I have a batch process which reads a text file and loads mysql DB
> tables. I see following error occasionally in log files. Finding it
> hard to trace but working on it.
> This app is on older Django 1.1.2. Has something like this encountered
> or fixed since then. Any clues.
>
> Error is "Enter a valid date/time in -MM-DD HH:MM[:ss[.uu]]
> format."
>
> ( Note: There are no screens or forms. It is a pure batch process.)
>

-- 
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: a noob in need (installing apps)

2011-04-09 Thread Vasil Vangelovski
A reusable application is a package. To use it you need to put the
package name in INSTALLED_APPS and depending if it provides any models
do syncdb after that (for mailer you need that).

Usually there's detailed instructions on what you need to do to get up
and running with a reusable app. But an INSTALLED_APPS entry is common
to all

Sometimes you will see bundles of larger packages containing multiple
apps, like django-cms for example.

In the case of django-mailer it is one package called 'mailer' so you
need to put the package name in your INSTALLED_APPS ('mailer').

For details on usage see this:

https://github.com/jtauber/django-mailer/blob/master/docs/usage.txt

On 4/10/11 12:45 AM, Pythia wrote:
> Hi!
>
> I've been building a django-powered site for the past week and having
> great fun.  I've got my site (on my dev server) doing exactly what I
> want it to do.  Now I want to set up an automatic email-sending
> algorithm using django-mailer:
>
> http://code.google.com/p/django-mailer/
>
> I installed it successfully (since I can now >>> import mailer).  But
> now I have a very basic question:
>
> What do I enter in settings.py in my project folder under
> INSTALLED_APPS?
>
> The django-mailer folder contains several subfolders with their own
> __init__.py files inside.
>
> In general, when one downloads a django package and installs it, how
> does one make it accessible to a project?
>
> Apologies for the basic question, but I just couldn't find an
> answer...
>
> -Pythia
>

-- 
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: deploying flex and django

2011-03-21 Thread Vasil Vangelovski
One option is to use flash vars to pass your django app url to your flex SWF
on initialization in your HTML page.
That way you don't have to rebuild your SWF for different environments.
And you may use a django template to render the html that embeds your swf so
you can change the
url conditionally depending on if debug is set to True or False.
Maybe there's a better way, but I'm not that experienced with Flex.


On Mon, Mar 21, 2011 at 6:58 PM, Sells, Fred
wrote:

> I would appreciate some guidelines on a better way to deploy a
> flex/flash frontend with a django backend.
>
> I've got flex and django working nicely using the Flex HTTPService and
> XML and the message content.  Probably not as efficient as other methods
> but this is an intratnet and performance is not an issue.  This is also
> my first django app, and although it's grown to be pretty significant,
> it still reflects some newbie mistakes.
>
> I'm deploying on linux and apache and using mod_python (because we've
> done that for years and I have not had time to research mod_wsgi).  I'm
> more of a programmer than a Unix or Apache administrator but we are a
> small shop and you gotta do what you gotta do to make it work.
>
> Some url's have been edited to avoid exposing potentially proprietary
> info.
>
> The problem is that I deploy the client and server separately like this:
>
> /var/www/html/myapp/index.html  launches my Flex app
> /var/www/django/mysite/app ... contains my django app.
>
> This works fine EXCEPT, I need to hardcode the django url into my Flex
> App based on my target deploy something like this.
>
>private static var LOCAL :String =
> "http://localhost:/django/mysite/app/;; //I use this with the debug
> server
>private static var QA:String =
> "http://mytestserver.mydomain.org/django/mysite/app/;;
>private static var PRODUCTION:String =
> "http://myprodserver.mydomain.org/django/mysite/app/;;
>private static var DJANGO_URL:String =PRODUCTION;
>
> So I have to edit and rebuild my Flex app for the different
> environments.  While that's not much effort I know it's just bad
> practice.  I would like the url's from flex/flash to django to be
> relative and thus I guess I should deploy my flash from django, I'm just
> a bit confused about the "static" and "media" directories.  I am using
> django 1.2.4; however I could upgrade to 1.3 if that makes for a cleaner
> solution.
>
> FWIW my apache conf file looks like this.
>
> 
>SetHandler python-program
>PythonHandler django.core.handlers.modpython
>SetEnv DJANGO_SETTINGS_MODULE app.settings
>PythonOption django.root /var/www//django/app
>PythonPath "['/var/www/django'] + sys.path"
>PythonDebug On
> 
>
> --
> 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.



Re: subclassing UserCreationForm

2010-09-24 Thread Vasil Vangelovski
> Mainly, I just don't think you're subclassing User for the right
> reasons. In fact, I can't really think of anytime I would subclass
> it.  Usually adding a related table is a better way to go (lookup
> django user profiles for example).
>

 There are times when the builtin User model is not enough, that's why there
is a way to specify user profiles. There are times when you want to be sure
that every user in the system has a profile (some filed in the profile is
required for the system to work properly), even for the users added from the
admin. This can lead people to try all kinds of hacks, like subclassing
user, which there is a way to implement but will lead you in all kinds of
trouble. Then there is the case where you want all users to be staff no
matter what, which makes the field superficial, but leads to extra
uneccessary work on the developers part to make sure it works that way.
These are all real world scenarios I've encountered, and I'm guilty of
pushing a subclassed user model in the past.

If the api leads a lot of people to try all kinds of hacks around it to
achieve what they want, blame the API not the people. Providing concrete
models for users in contrib leads to more pain than the time or trouble it
saves.

-- 
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: python setup.py install errors

2010-09-12 Thread Vasil Vangelovski
Is that NAS with an ARM processor? It might be caused by a bug in python
2.5:

http://bugs.python.org/issue1762561

On Sat, Sep 11, 2010 at 11:26 PM, S66  wrote:

> hi there,
>
> i tried to get the current version of django working on my NAS, but
> when i run
> python setup.py install
> i get this error:
>
>
> byte-compiling /ffp/lib/python2.5/site-packages/django/template/
> defaultfilters.py to defaultfilters.pyc
> Traceback (most recent call last):
>  File "setup.py", line 96, in 
>'Topic :: Software Development :: Libraries :: Python Modules',
>  File "/mnt/HD_a2/home/funplug/work/Python-2.5.2/pkg/ffp/lib/
> python2.5/distutils/core.py", line 151, in setup
>  File "/mnt/HD_a2/home/funplug/work/Python-2.5.2/pkg/ffp/lib/
> python2.5/distutils/dist.py", line 974, in run_commands
>  File "/mnt/HD_a2/home/funplug/work/Python-2.5.2/pkg/ffp/lib/
> python2.5/distutils/dist.py", line 994, in run_command
>  File "/mnt/HD_a2/home/funplug/work/Python-2.5.2/pkg/ffp/lib/
> python2.5/distutils/command/install.py", line 510, in run
>  File "/ffp/lib/python2.5/cmd.py", line 333, in run_command
>del help[cmd]
>  File "/mnt/HD_a2/home/funplug/work/Python-2.5.2/pkg/ffp/lib/
> python2.5/distutils/dist.py", line 994, in run_command
>  File "/mnt/HD_a2/home/funplug/work/Python-2.5.2/pkg/ffp/lib/
> python2.5/distutils/command/install_lib.py", line 99, in run
>  File "/mnt/HD_a2/home/funplug/work/Python-2.5.2/pkg/ffp/lib/
> python2.5/distutils/command/install_lib.py", line 135, in byte_compile
>  File "/mnt/HD_a2/home/funplug/work/Python-2.5.2/pkg/ffp/lib/
> python2.5/distutils/util.py", line 499, in byte_compile
>  File "/ffp/lib/python2.5/py_compile.py", line 138, in compile
>marshal.dump(codeobject, fc)
> ValueError: unmarshallable object
>
>
> any ida how to solve the 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-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.
>
>

-- 
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: home page menu view variables cross every view?

2010-09-07 Thread Vasil Vangelovski
You can use your own template for flatpages, see
http://docs.djangoproject.com/en/dev/ref/contrib/flatpages/?from=olddocs#flatpage-templates
Just make that menu a separate template and include it wherever you want. Of
course your flatpages template and your other templates can inherit from the
same base where the menu is included.

I  don't know what you mean by  "place
these variables ( db queries)"? Anyway if your menu is generated from a
database and it won't change often it's a good idea to wrap such template
code in a cache tag, especially if you make manny queries to generate that
menu.

On Tue, Sep 7, 2010 at 8:55 PM, Goran  wrote:

> I'm Django novice and I want to have some menu (top menu) which have
> some dynamically populated items. So inside home page view I have some
> variables to get these menu items. But because it's top menu I need it
> on every page on the site and i have about 20 views.  So I'm place
> these variables ( db queries) in every view on the site. It works
> except on the Flatpages because I can't find a way to extend Flatpage
> view with these variables. Now I have two questions:
>
> 1. How can I extend FlatPage view to get these menu variables on the
> flatpages.
> 2. Am I miss something? What's happen with D.R.Y. if I need to place
> the same variables on the every view and repeat myself 20 times?
>
> Any advice?
> 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.
>
>

-- 
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: sessions across subdomains - required settings?

2010-06-17 Thread Vasil Vangelovski
Not really. Giving them a different secret key won't make much
difference. Just make sure your site id is the same.

On Thu, Jun 17, 2010 at 11:22 AM, Aljosa Mohorovic
 wrote:
> if i have a project with domain example.com and it's deployed as 3
> wsgi apps:
> - www.example.com
> - admin.example.com
> - api.example.com
> is there something in settings.py that should be shared across wsgi
> apps except SESSION_COOKIE_DOMAIN?
>
> i can't figure out if i should use the same SECRET_KEY in all settings
> or it doesn't matter?
> just to be clear, all 3 wsgi apps are basically the same project and
> they access the same database.
>
> 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 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.
>
>

-- 
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: custom template tags with a raw query

2010-06-15 Thread Vasil Vangelovski
To use custom SQL see this for reference:

http://docs.djangoproject.com/en/dev/topics/db/sql/

To create a templatetag see this for reference:

http://docs.djangoproject.com/en/dev/howto/custom-template-tags/



On Mon, Jun 14, 2010 at 10:08 PM, Cole743  wrote:
> Hello again,
>
> My last question may have been unclear, so I'm going to be more
> specific.
>
> I want to use the results of this:
> cursor.execute("SELECT * from sp_getreport(""varchar"" %s)", [usr])
>
> (or something similar) In a custom template tag to display in a
> template. The results of the query are:
> a user name, a message, an address, a date, and a primary key.
>
> I've read any number of articles on the topic, but I'm still having
> trouble understanding how to create the necessary custom tags to
> accomplish this. How would I go about writing this?
>
> -Cole
>
> --
> 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.
>
>

-- 
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: Is there a way to force a template to get translated to a certain language without passing RequestContex?

2010-06-10 Thread Vasil Vangelovski
Thanks for the help.

On Thu, Jun 10, 2010 at 12:49 PM, Tom Evans <tevans...@googlemail.com> wrote:
> On Thu, Jun 10, 2010 at 11:39 AM, Vasil Vangelovski
> <vvangelov...@gmail.com> wrote:
>> I'm rendering a template with a management command (something I need
>> for producing documentation in my native language). So I've no request
>> object, so no RequestContext. Is there a way I can force the template
>> rendering process to lookup translation strings from a particular
>> language other than English?
>>
>
> Sure, just activate the language you wish to have displayed:
>
> This is some code I use to send admin initiated emails to users in
> their selected native language:
>
> from django.utils import translation
>
> if settings.DISPLAY_I18N:
>  cur_language = translation.get_language()
>  if not language:
>    if user is not None:
>      language = user.get_profile().language
>    else:
>      language = 'en'
>  translation.activate(language)
>
> text_body, html_body, subject = 
>
> if settings.DISPLAY_I18N:
>  translation.activate(cur_language)
> return text_body, html_body, subject
>
>
> Cheers
>
> Tom
>
> --
> 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.
>
>

-- 
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.



Is there a way to force a template to get translated to a certain language without passing RequestContex?

2010-06-10 Thread Vasil Vangelovski
I'm rendering a template with a management command (something I need
for producing documentation in my native language). So I've no request
object, so no RequestContext. Is there a way I can force the template
rendering process to lookup translation strings from a particular
language other than English?

-- 
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: search like google

2010-06-06 Thread Vasil Vangelovski
See haystack http://haystacksearch.org/

On Sun, Jun 6, 2010 at 9:10 AM, Odagi  wrote:
> Hello users,
>
> I'd like to implement searches like google (i.e., resolve typos or
> similar words). For example, if I'm looking for the word 'manatan' the
> search engine should match similar words like:
>
> 'manatan'
> 'manhattan'
> etc.
>
> How can I do that using Django' querysets?
>
> Many thanks for your attention,
> Odagi
>
>
>
>
> --
> 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.
>
>

-- 
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: How to share a session with a php application.

2010-06-05 Thread Vasil Vangelovski
Not directly.

The session cookie stores the session id (session key). The session id
references data stored for the session in the django session backend.
The user for that session is contained in that data. So it really
depends on what the session backend is. So I'll assume it's the
default which is the database backend which keeps this data in the
django_session table, which has a column session_data which holds an
encoded (pickled) python dict with the session data, which I'm 99.99%
sure you can't decode directly from PHP, because it's a serialize
Python object. So if you can't access it directly from PHP you need to
open a service of some sort on your django application or anything
that's written in python that would give this data to the PHP
application, this service should be only accessed from the PHP app on
the serverside for good security. So it requires punching holes for no
special reason. Or is there something very special about this PHP
script that you can't do with 10-200 times less code in your django
application?

On Sat, Jun 5, 2010 at 5:18 PM, nameless <xsatelli...@gmail.com> wrote:
>
> Someone has telled me that I could share the user id ( from Django and
> PHP )
>  also throught a cookie.
> In your opinion what is the best way ?
>
> Thanks ^_^
>
> -----
>
> On Jun 5, 4:01 pm, Vasil Vangelovski <vvangelov...@gmail.com> wrote:
>> set
>>
>> SESSION_COOKIE_DOMAIN=".mychatapp.com"
>>
>> this will make the django cookie valid both forwww.mychat.comand
>> chat.mychat.com
>>
>> On Sat, Jun 5, 2010 at 2:34 PM, nameless <xsatelli...@gmail.com> wrote:
>> > If the chat is in a subdomain ?
>>
>> > 
>>
>> > On Jun 5, 2:05 pm, Vasil Vangelovski <vvangelov...@gmail.com> wrote:
>> >> It's possible if both of your applications are under the same domain.
>> >> see the SESSION_COOKIE_* settings variables
>>
>> >>http://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-age
>>
>> >> You can then find the current user by the sessionid from the django_* 
>> >> tables.
>>
>> >> On Sat, Jun 5, 2010 at 1:40 PM, nameless <xsatelli...@gmail.com> wrote:
>>
>> >> > I have a django blog project and a chat in PHP.
>>
>> >> > I need to share the id of the user logged in django
>> >> > ( request.user.id ) with the chat in PHP.
>>
>> >> > Is this possible ?
>>
>> >> > --
>> >> > 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 
>> >> > athttp://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-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://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-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.
>
>

-- 
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: error : Django with Apache and mod_python

2010-06-05 Thread Vasil Vangelovski
It seems that your application is trying to render a template that
doesn't exist.

And why are you using mod_python anyway?

On Sat, Jun 5, 2010 at 5:49 PM, Jagdeep Singh Malhi
 wrote:
>
> MOD_PYTHON ERROR
>
> ProcessId:      3219
> Interpreter:    '127.0.1.1'
>
> ServerName:     '127.0.1.1'
> DocumentRoot:   '/var/www'
>
> URI:            '/'
> Location:       '/'
> Directory:      None
> Filename:       '/var/www/'
> PathInfo:       ''
>
> Phase:          'PythonHandler'
> Handler:        'django.core.handlers.modpython'
>
> Traceback (most recent call last):
>
>  File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line
> 1537, in HandlerDispatch
>    default=default_handler, arg=req, silent=hlist.silent)
>
>  File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line
> 1229, in _process_target
>    result = _execute_target(config, req, object, arg)
>
>  File "/usr/lib/python2.6/dist-packages/mod_python/importer.py", line
> 1128, in _execute_target
>    result = object(arg)
>
>  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> modpython.py", line 228, in handler
>    return ModPythonHandler()(req)
>
>  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> modpython.py", line 201, in __call__
>    response = self.get_response(request)
>
>  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> base.py", line 130, in get_response
>    return self.handle_uncaught_exception(request, resolver,
> sys.exc_info())
>
>  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
> base.py", line 181, in handle_uncaught_exception
>    return callback(request, **param_dict)
>
>  File "/usr/local/lib/python2.6/dist-packages/django/views/
> defaults.py", line 23, in server_error
>    t = loader.get_template(template_name) # You need to create a
> 500.html template.
>
>  File "/usr/local/lib/python2.6/dist-packages/django/template/
> loader.py", line 157, in get_template
>    template, origin = find_template(template_name)
>
>  File "/usr/local/lib/python2.6/dist-packages/django/template/
> loader.py", line 138, in find_template
>    raise TemplateDoesNotExist(name)
>
> TemplateDoesNotExist: 500.html
>
>
> please help what  I can do ???
>
> --
> 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.
>
>

-- 
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: How to share a session with a php application.

2010-06-05 Thread Vasil Vangelovski
It's possible if both of your applications are under the same domain.
see the SESSION_COOKIE_* settings variables

http://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-age

You can then find the current user by the sessionid from the django_* tables.

On Sat, Jun 5, 2010 at 1:40 PM, nameless  wrote:
>
> I have a django blog project and a chat in PHP.
>
> I need to share the id of the user logged in django
> ( request.user.id ) with the chat in PHP.
>
> Is this possible ?
>
> --
> 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.
>
>

-- 
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.



Getting all the concrete model classes inheriting from a certain abstract model class

2010-06-04 Thread Vasil Vangelovski
Hi

I have around 30 models inheriting from one abstract model class and
the number may grow (there's a specific reason for this design
decision, involving making the database easy for people to make
reports from the data with other tools, namely ms access, and making
it easier to make changes to specific models ). I want to
programmaticaly set permissions to all these models for specific
groups in a management command (since dumping permissions wont work,
and setting them by hand takes a lot of time). So what I want to do is
get a list of all the concrete model classes inheriting  from a
certain abstract (or not) base class. Is there a specific way to do
this?

-- 
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: Serving media files with Django/Apache/Nginx

2010-06-01 Thread Vasil Vangelovski
Using the alias directive is much more easier and straighforward, for
me at least.  Here's an example configuration

  upstream django-backend
  {
server testsite.local:4080;
  }


   server {
listen 80;
server_name testsite.com;

location /{
proxy_redirect http://testsite.local:4080/ http://$host/;
proxy_set_header X-REAL-IP $remote_addr;
proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
proxy_connect_timeout   5;
proxy_send_timeout  15;
proxy_read_timeout  60;
proxy_set_header Host "testsite.local:4080";
proxy_pass http://django-backend;

}

location /static {
alias /home/vasil/Projects/django-test/djangoproject/static;
}
   }



On Tue, Jun 1, 2010 at 11:40 PM, Corey  wrote:
> I am a Django newbie and Im using Django to build an application. Im
> using Apache/mod_wsgi and Nginx as a proxy server to serve static
> files.I am running Nginx on port 80 and have all the Django pages
> forwarded to Apache. I have my media folder in the application root
> folder named media1. I cannot get Nginx to find and serve up my media
> files. Here is the different pieces i have.
>
> Nginx config:
>
> server {
>        listen       80;
>        server_name  localhost;
>
>        #charset koi8-r;
>
>        #access_log  logs/host.access.log  main;
>
>        location / {
>        proxy_pass         http://127.0.0.1:8080/;
>        proxy_redirect     off;
>
>        proxy_set_header   Host             $host;
>        proxy_set_header   X-Real-IP        $remote_addr;
>        proxy_set_header   X-Forwarded-For
> $proxy_add_x_forwarded_for;
>        proxy_max_temp_file_size 0;
>
>        client_max_body_size       10m;
>        client_body_buffer_size    128k;
>
>        proxy_connect_timeout      90;
>        proxy_send_timeout         90;
>        proxy_read_timeout         90;
>
>        proxy_buffer_size          4k;
>        proxy_buffers              4 32k;
>        proxy_busy_buffers_size    64k;
>        proxy_temp_file_write_size 64k;
>    }
>        location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|
> exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
>            root   /media1/;
>        }
>
>
> Django SETTINGS config:
>
> MEDIA_ROOT = 'C:/Python26/Lib/site-packages/django/bin/blazinsports/
> media1/'
> MEDIA_URL = 'http://localhost/media1/'
> ADMIN_MEDIA_PREFIX = '/media/'
>
> What do I need to change to get Nginx to serve up my media files??
> Thanks for your 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 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-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.



What would be the best way to implement a login audit?

2010-05-29 Thread Vasil Vangelovski
I'm developing an intranet application where one of the requested
features is having a detailed log containing entries of IP, user and
timestamp every time someone has logged in successfully. Also as a
bonus feature I'd like to implement a log of failed login attempts.
What would be the cleanest approach to do this?
Wrap the login view in contrib.auth with my own?
Or write a custom auth backend?

-- 
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.



A question about form inheritance and form media as a dynamic property

2010-05-25 Thread Vasil Vangelovski
I have a form class, call it MyBaseForm which defines some media as a
dynamic property (by providing a media property, not defining a Media
class). Then I have MyForm which inherits from MyBaseForm and
overrides some widgets on it's fields, these widgets have their own
media definitions. The problem is MyForm.media doesn't contain the
media for the widgets. If I change MyForm to inherit from ModelForm
everything works fine. Is there a way around this?

-- 
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.



Overriding ForeignKey widget CSS classes in the admin

2010-05-22 Thread Vasil Vangelovski
Hi

I'm trying to build the CSS class attributes for all the widgets in my
ModelForm dynamically in the form's __init__ method. This seems to
work for  and input widgets, but doesn't work if the 
is for a foreign key field. From what I can see the BaseModelAdmin
replaces widgets for foreign keys disregarding any attributes set to
the original widget in the form. Is there a way to go around this?

-- 
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: Open source CMS (if based on Django better)

2010-05-07 Thread Vasil Vangelovski
Have a look into LFC (lightning fast CMS) http://demo.django-lfc.com/,
seems to be pretty flexible.

On Wed, May 5, 2010 at 9:52 PM, Jonatan.mv  wrote:
> What would be you recommended CMS?. Could you please give some reasons
> (pro and cons)?.
>
> I'm investigating on these:
>
> - PyLucid v0.8.x stable, v0.9 alpha
> - FeinCMS v1.1.0 stable
> - django-simplecms
> - django-cms-2.0 2.0.2 stable , 2.1 alpha
> - google-sites
>
> By the way... I like how google-sites work, ¿Do you know the
> technology they use?
>
> Thanks in advance !
>
> --
> 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.
>
>

-- 
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: Sending email via SMTP in a unit test

2010-04-23 Thread Vasil Vangelovski
Yes, I'm using trunk (1.2).
Thanks Russell, that helped.

On Fri, Apr 23, 2010 at 1:59 PM, Russell Keith-Magee
<freakboy3...@gmail.com> wrote:
> On Fri, Apr 23, 2010 at 6:27 PM, Vasil Vangelovski
> <vvangelov...@gmail.com> wrote:
>> Is there a way to run unit tests in such a way that email will be sent
>> via the SMTP email backend when there's a call to send_mail in the
>> unit test?
>
> In 1.1; no. In 1.1, Django has a single mail API, and the test setup
> code replaces that API with a mock during setup. The only way to send
> mail would be to open a Python SMTP connection instead of using
> Django's mail API.
>
> However, in trunk (soon to be 1.2), it is possible. Although the
> default mail API is still mocked out, you can manually instantiate an
> SMTP connection. See [1] for more details.
>
> [1] 
> http://docs.djangoproject.com/en/dev/topics/email/#obtaining-an-instance-of-an-e-mail-backend
>
> Yours,
> Russ Magee %-)
>
> --
> 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.
>
>

-- 
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.



Sending email via SMTP in a unit test

2010-04-23 Thread Vasil Vangelovski
Is there a way to run unit tests in such a way that email will be sent
via the SMTP email backend when there's a call to send_mail in the
unit test?

-- 
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: how do you build an html website in python?

2010-04-17 Thread Vasil Vangelovski
That website is built using django which is a web framework built in
python. If you want info on how to build a website using django
consult the django tutorial:
http://docs.djangoproject.com/en/dev/intro/tutorial01/ and the docs:
http://docs.djangoproject.com/en/dev/contents/,
If you want to build a website in pure python ask on the python mailing list.

On Sat, Apr 17, 2010 at 3:06 PM, codecub  wrote:
> i want to create a website like whalesalad.com and ive read through
> the python documentation but it doesnt explain building a website out
> of scratch in python
>
> --
> 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.
>
>

-- 
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: How to implement i18n in javascript

2010-04-05 Thread Vasil Vangelovski
Can you be more precise about what part doesn't work? Did you include
the javascript translation catalog in you HTML template with a

Re: Hosting for Django sites

2010-04-05 Thread Vasil Vangelovski
I've nothing but positive impressions from Slicehost so far.

- All their VPS plans (slices) work pretty fast and each is mostly
limited by the amount of memory you need and are prepared to pay for.
- Resizing a slice (changing a plan) is painless and fast.
- You are the master of your own slice, no stupid management panels,
you choose what you want to install there from the ground up.
- They offer pretty up to date linux distros to choose from.



On Sat, Apr 3, 2010 at 4:39 PM, django_jedi  wrote:
> Hi Folks,
>
> I'm wondering what people would recommend for hosting Django sites?
> I've read the blog posts; I'm wondering what the latest word on the
> street would be.  We're talking about hosting multiple Django/Satchmo
> installs, possibly w/dedicated/managed servers.
>
> Among the leading contenders so far:
>
> - Webfaction
> - Media Temple
> - Rackspace Cloud/Slicehost
>
> Thoughts?
>
> TIA.
>
> --
> 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.
>
>

-- 
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: decorators

2010-04-05 Thread Vasil Vangelovski
It's a deprecation warning. It means that some code in
facebook.djangofb uses some part of the standard library that will be
gone from future releases of python (for example python 2.7). Since
it's not in your code but in some package you are using, it's the
responsibility of the maintainers of that package to handle that, and
it's nothing for you to worry about. If you don't want to see any
deprecation warnings you can invoke the interpreter with:
-Wignore::DeprecationWarning

Why are you asking this on the Django mailing list? You'll probably
get a more thorough explanation asking the same question on the python
mailing list. Or by reading this:
http://www.python.org/dev/peps/pep-0004/

On Sun, Apr 4, 2010 at 6:43 PM, CrabbyPete  wrote:
> I am using pyfacebook and when I run the debug server I get the
> following:
>
> C:\Python26\lib\site-packages\facebook\djangofb\__init__.py:185:
> DeprecationWarning: Calling the deprecated function 'new_wrapper'
> Downgrade to decorator 2.3 if you want to use this functionality
>  return decorator.new_wrapper(updated, f)
>
> Can someone please explain this to me.
>
> 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.
>
>

-- 
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: error about django and mssql

2010-04-05 Thread Vasil Vangelovski
Well, the error message is pretty concise, a connection to the
database server can't be opened. See if you can connect to the same
database from the same machine with another client (for example
Management Studio Express) to check if all the parameters in your
connection string are correct.

On Mon, Apr 5, 2010 at 4:27 AM, CCC  wrote:
> hi,now I use django-mssql and sqlserver2008,
> but I found that it always appear some errors when I do some
> command,for example:python manage.py syncdb
> the error likes coding error is blow:
> raise OperationalError(e, "Error opening connection: " +
> connection_string)
> ngo.db.backends.sqlserver_ado.dbapi.OperationalError:
> (com_error(-2147352567,
> xb7\xa2\xc9\xfa\xd2\xe2\xcd\xe2\xa1\xa3', (0, u'Microsoft OLE DB
> Provider for
> L Server', u'[DBNETLIB][ConnectionOpen (Connect()).]SQL Server \u4e0d
> \u5b58\u
> 8\u6216\u62d2\u7edd\u8bbf\u95ee\u3002', None, 0, -2147467259), None),
> 'Error
> ning connection: PROVIDER=SQLOLEDB;DATA
> SOURCE=115.238.106.100,60433;Network
> rary=DBMSSOCN;Initial Catalog=rvdb_1;UID=sa;PWD=asd.1234')
>
>
> anyone can help ?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.
>
>

-- 
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: Customizing the Sites framework

2010-03-21 Thread Vasil Vangelovski
Either use model inheritance or one by one relationships with the Site model.
The other solution which doesnt require changing django's code
 would be monkeypatching (changing the class in runtime from the models.py
 file of one of your apps), not a great idea.


On Sun, Mar 21, 2010 at 4:43 AM, ejm  wrote:
> Hi,
>
> My app uses a model called Site which is essentially the same as in
> the django.contrib.sites framework (domain and name), except that my
> model needs an extra field and is related through a foreign key to
> another model. (It is related to a model called Client, which stores
> all my Clients, and the relationship translates to "Client owns zero
> or more Sites").
>
> I am wondering: should I use the django.contrib.sites framework? and,
> what would be the best method of extending
> django.contrib.sites.models.Site?
>
> I am inclined to try to take advantage of Django's Site model, as
> redefining a separate Site system is a very obvious case of redundant,
> "boilerplate" code. So my question comes down to: any ideas on how to
> do this?
>
> I could use multi-table inheritance and extend the Site class, which
> would create a new table that with a foreign key linking it to to the
> django_sites table. But I don't like this solution. I would rather use
> the Abstract base classes method of inheritance, meaning there is only
> one django_sites table. But this would mean hacking the source code of
> the django.contrib.sites.models.Site class to add the abstract = True
> to the Meta class, etc. Changing the source code doesn't sound like a
> good idea either; it could cause issues with upgrading the sites
> framework, etc.
> There may be a simple solution in the form of a language feature I'm
> not familiar with (I'm a Python beginner). I'm thinking along the
> lines of modifying django.contrib.sites.models.Site's inner Meta class
> at runtime, before extending it with my customized Site model.
>
> Thanks in advance for any ideas.
>
> --
> 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.
>
>

-- 
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: Scripting Import of CSV data?

2010-02-23 Thread Vasil Vangelovski
Write a management command that downloads the CSV from email and loads
it in your database. Set up a cron job that calls the management
command. This is how I would do it.

There may be some unnecessary complication with that approach, like
figuring out which emails contain the CSVs of interest etc. Accessing
the database those CSVs come from is another option which just became
much easier to do with Django 1.2 with multiple database supportl Keep
in mind that if that database is on a remote server there would be a
need to punch holes through firewalls and opening connections and
executing queries against that database may take significant amount of
time.

On Wed, Feb 24, 2010 at 1:05 AM, Victor Hooi  wrote:
> heya,
>
> I have a Django app that will need to grab CSV data being sent to an
> email address into it's own database.
>
> I'm assuming if I can get IMAP access to the mailbox, I can just
> script all of that part in Python. However, what's the best way of
> scheduling the process, so that it'll regularly check the mailbox?
> Just make it a cron job, or is there a more integrated way of doing it
> inside of Django?
>
> Actually, is this the best way of doing it, importing the data this
> way? Or if say, I could get access to the underyling database behind
> those CSV files, would I be better off trying the approach here
> (http://docs.djangoproject.com/en/dev/howto/legacy-databases/). Or
> should I just import the data into a clean Django-originated database
> and leave it at that?
>
> Cheers,
> Victor
>
> --
> 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.
>
>

-- 
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: anybody tried web2py and gone back to Django?

2010-02-18 Thread Vasil Vangelovski
I've looked at it a couple of months ago. There are some great ideas behind it.

Web2Py cons:
1. The first and biggest issue at the time was that there was no
sufficient/accessible documentation available for free. The book was
only available on scribd for free which is horrible. Now the book is
available as a wiki and I applaud that.
2. It avoids explicit imports. Technically this might not be a bad
thing, but if you've been developing in Python for some time feels
very awkward (it doesn't feel right).
3. Coding convention. Uses all uppercase names all over the place,
even where they don't refer to constants.
4. This is a very subjective reason. It's marketed as an enterprise framework.

Django pros:
1. I'm familiar with it. I Know my way around it's documentation and
codebase. I've actually used it to build real, working software.
2. GIS, django.contrib.gis makes all aspects of GIS related web
development so trivial. Nothing can match that.
3. Admin, nothing can match that.
4. As a  framework It has a beautiful design that is constantly
improving. Where just writing code in web2py doesn't give me that
feeling, things like avoiding explicit imports worry me.
5. The galaxy of reusable django apps. Even if most of them don't
always apply to my problem I can take an idea and apply it to my
problem.
6. The culture in the django community of releasing django-related
code under permissive licences (BSD). And the whole culture in
general.
7. Finding people to work with me on django projects is much easier
than for any other Python framework.


On Wed, Feb 17, 2010 at 9:48 PM, snfctech  wrote:
> If so, could you provide a bullet list of things you preferred in
> Django?  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.
>
>

-- 
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: Creating an external url in the django admin section

2010-02-08 Thread Vasil Vangelovski
You can override the template for a specific app by first copying it
to a template folder respectful to that app
See this:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates



On Mon, Feb 8, 2010 at 8:16 AM, djangonoob  wrote:
> Hi all.
>
> If someone could please help me as I am very new to django and getting
> desperate for help.
>
> The issue is as follows:
>
> For one of my apps in 'INSTALLED APPS' I need to add a link in the
> admin section that will cause the stats to be downloaded. The URL for
> this link is /questionnaire/export_csv. How can I define such a link
> please?
>
> Thank you for your help.
>
> This is the template but as you will see this creates the link for the
> questionnaire/export_csv, but it does create the link for every single
> app instead of just for the Questionnaire app.
>
> admin_index.py
> {% extends "admin/base_site.html" %}
> {% load i18n %}
>
> {% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/
> base.css{% endblock %}
>
> {% block coltype %}colMS{% endblock %}
>
> {% block bodyclass %}{% endblock %}
>
> {% block breadcrumbs %}{% endblock %}
>
> {% block content %}
> 
>
> {% if app_list %}
>    {% for app in app_list %}
>        
>        
>        {%
> blocktrans with app.name as name %}{{ name }}{% endblocktrans %} caption>
>        {% for model in app.models %}
>            
>            {% if model.perms.change %}
>                 href="{{ model.admin_url }}">{{ model.name }}
>            {% else %}
>                {{ model.name }}
>            {% endif %}
>
>            {% if model.perms.add %}
>                 class="addlink">{% trans 'Add' %}
>            {% else %}
>                
>            {% endif %}
>
>            {% if model.perms.change %}
>                 class="changelink">{% trans 'Change' %}
>            {% else %}
>                
>            {% endif %}
>            
>        {% endfor %}
>        Export-to-
> CSV
>                
>        
>    {% endfor %}
> {% else %}
>    {% trans "You don't have permission to edit anything." %}
> {% endif %}
> 
> {% endblock %}
>
> {% block sidebar %}
> 
>    
>        {% trans 'Recent Actions' %}
>        {% trans 'My Actions' %}
>            {% load log %}
>            {% get_admin_log 10 as admin_log for_user user %}
>            {% if not admin_log %}
>            {% trans 'None available' %}
>            {% else %}
>            
>            {% for entry in admin_log %}
>            {% if not entry.is_deletion %} href="{{ entry.get_admin_url }}">{% endif %}{{ entry.object_repr|
> escape }}{% if not entry.is_deletion %}{% endif %} class="mini quiet">{% filter capfirst %}{% trans
> entry.content_type.name %}{% endfilter %}
>            {% endfor %}
>            
>            {% endif %}
>    
> 
> {% endblock %}
>
> --
> 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.
>
>

-- 
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: Using ForeignKey with dJango and PyAMF

2010-02-08 Thread Vasil Vangelovski
There's a bug in PyAMF: http://dev.pyamf.org/ticket/694


On Mon, Feb 8, 2010 at 5:54 PM, WC  wrote:
> Hi Everyone,
>
> I have a ForeignKey field that is always null on the Flex client.  I
> have tried using select_related(), but it's still null.  Any idea what
> I am doing wrong?  In the following sample code, parentBlock is always
> null on the Flex client:
>
> File: BlockVO.py
> from django.db import models
>
> class Block(models.Model):
>    blockName = models.CharField(max_length=200)
>    blockLabel = models.CharField(max_length=200)
>    blockColor = models.PositiveIntegerField()
>    xBlockPos = models.IntegerField()
>    yBlockPos = models.IntegerField()
>    parentConnectionType = models.CharField(max_length=200,
> blank=True, null=True)
>    parentBlock = models.ForeignKey('self', blank=True, null=True)
>    def __unicode__(self):
>        return self.blockLabel
>
> File gateway.py
> # To get all Blocks
> def getBlocks():
>    return Block.objects.all().select_related()
>
> File page.as
>       private function onResult_blocks(data:Object):void {
>                var answer : Array = ArrayUtil.toArray(data);
>                trace("Server returned " + answer.length.toString() + "
> block(s)");
>                        for each (var item:BlockVO in answer) {
>                                if(null == item.parentBlock) {
>                                        trace("for bloc id=" + item.id + 
> "parentBlock is null");
>                                } else {
>                                        trace("for bloc id=" + item.id + 
> "parentBlock_id=" +
> item.parentBlock.id);
>                                }
>                        var newBlock : Block = new Block(workspace, false,
> item.blockLabel, 0x66FF66, BlockSpec.REPORTER, null, item);
>                                blocks.push(newBlock);
>                                addChild(newBlock);
>                        }
>        }
>
> --
> 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.
>
>

-- 
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.



A question about model form inheritance

2009-10-04 Thread Vasil Vangelovski

Lets say I have one form which inherits from ModelForm and a second
one that inherits from the first one. What I want to do is add 2
fields in the second form, the fields are bound to the properties of
the model. Which would be the best way to do this?

Example:

the model has fields: name, content, price, currency...

I want the BasicForm class to have only the name and content fields
and the PriceForm which inherits from BasicForm to have the fields
from the first one + price and currency.

This example is oversimplified, in practice my model has at least 10
fields and I'd have at least 4 different forms which would inherit
from the BaseForm and will be used depending on the category of the
model instance.

--~--~-~--~~~---~--~~
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/ Python 3 - nervous about starting large project

2009-08-08 Thread Vasil Vangelovski

If you are writing your code in python 2.6 it will be easy to port it to 
python 3 later. The backwards incompatible changes introduced in python 
3 are not a good reason not to write you web application with django.

snfctech wrote:
> Hello.
>
> We are researching technologies to begin what may become a pretty
> large intranet Dashboard project.
>
> I'm a PHP developer, so the fact that Django uses Python doesn't give
> me a head-start - but I've been wanting to consider it, because I am
> interested in learning Python.
>
> However, I'm nervous about the Python 3 situation.  What if I start
> building a large project based on Django/Python 2.6, and then a year
> or two down the road the project starts limping because of all of the
> cool new Python 3 modules coming out?  And I've got a bunch of Django/
> Python 2.6 code that needs to be ported?
>
> Any tips would be greatly appreciated.  Thanks.
>
> Tony
>
> >
>   


--~--~-~--~~~---~--~~
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: is it possible to do a monkey patch on django.contrib.atuh.models.User to make the email field unique?

2009-08-04 Thread Vasil Vangelovski

Thanks Alex, that worked.

Alex Koshelev wrote:
> Hi, Vasil!
>
> `Field.unique` is the read only property. If you want to set 
> uniqueness you have to assign field's `_unique` attribute to True.
>
> ---
> Alex Koshelev
>
>
> On Wed, Aug 5, 2009 at 12:54 AM, Vasil Vangelovski 
> <vvangelov...@gmail.com <mailto:vvangelov...@gmail.com>> wrote:
>
>
> Having this line of code:
>
> User._meta.get_field('is_staff').default = True
> in the models.py for one of my apps works without problems.
> I wonder if it's possible to make email unique and
> first_name,last_name
> unique_together by using this technique.
>
> This:
>
> User._meta.get_field('email').unique = True
> fails with  AttributeError: can't set attribute.
>
> I know I can enforce uniqueness in forms but it would be nice if this
> can be done by modifying the User class and have the database field be
> unique because the same database may need to be accessed from
> outside of
> a django project.
>
>
>
>
> >


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



is it possible to do a monkey patch on django.contrib.atuh.models.User to make the email field unique?

2009-08-04 Thread Vasil Vangelovski

Having this line of code:

User._meta.get_field('is_staff').default = True
in the models.py for one of my apps works without problems.
I wonder if it's possible to make email unique and first_name,last_name 
unique_together by using this technique.

This:

User._meta.get_field('email').unique = True
fails with  AttributeError: can't set attribute.

I know I can enforce uniqueness in forms but it would be nice if this 
can be done by modifying the User class and have the database field be 
unique because the same database may need to be accessed from outside of 
a django project.

--~--~-~--~~~---~--~~
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: psycopyg setup error: no build_ext

2009-08-02 Thread Vasil Vangelovski

 From that bash interaction I can assume you are running os x.

The absolutely easiest way to install postgresql and psycopg2 on os x is 
with postgresplus.
These links may help if you decide to go down that path:

http://www.enterprisedb.com/products/postgres_plus/overview.do
http://blog.jonypawks.net/2008/06/20/installing-psycopg2-on-os-x/

Matt Hampel wrote:
> Setting the pg_config path got me to the next stage of errors, which
> is a step forward. Thanks!
>
> Now I get a permission denied error without any more information or
> context.
> Any suggestions?
>
> What I tried:
>
> matth:psycopg2-2.0.11 matth$ python setup.py build
> running build
> running build_py
> running build_ext
> error: Permission denied
> matth:psycopg2-2.0.11 matth$ sudo python setup.py build
> Password:
> running build
> running build_py
> running build_ext
> error: Permission denied
>
>
>
> On Jul 19, 12:20 am, walty  wrote:
>   
>> thx, it solves my problem (psycopg2-2.0.11 on OSX) right away :)
>>
>> just drop a few more words:
>> if installed the postgresql 8.4 using mac binary, the line of
>> configuration (inside setup.cfg) should be:
>> pg_config=/Library/PostgreSQL/8.4/bin/pg_config
>>
>> On Jul 7, 6:17 am, Justin Johnson  wrote:
>>
>> 
>>> I corrected the build_ext error and successfully built/installed by
>>> adding the full path to pg_config in setup.cfg.
>>>   
>>> On Jun 23, 10:19 am, Chris Haynes  wrote:
>>>   
 Using what I believe is the latest version of psycopyg, I get:
 
 509 ~/Desktop/psycopg2-2.0.9$ python setup.py build
 running build
 running build_py
 creating build
 creating build/lib.macosx-10.3-fat-2.6
 creating build/lib.macosx-10.3-fat-2.6/psycopg2
 copying lib/__init__.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
 copying lib/errorcodes.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
 copying lib/extensions.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
 copying lib/extras.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
 copying lib/pool.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
 copying lib/psycopg1.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
 copying lib/tz.py -> build/lib.macosx-10.3-fat-2.6/psycopg2
 runningbuild_ext
 error: No such file or directory
 
 and easy_install doesn't work either (seems like the same problem):
 
 510 ~/Desktop/psycopg2-2.0.9$ easy_install .
 Processing .
 Running setup.py -q bdist_egg --dist-dir /Users/home/Desktop/
 psycopg2-2.0.9/egg-dist-tmp-mYsMSq
 error: Setup script exited with error: No such file or directory
 
>
> >
>   


--~--~-~--~~~---~--~~
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 Allow "-" character in usernames in the admin application

2009-07-31 Thread Vasil Vangelovski

You can unregister the User model and default UserAdmin from the admin 
site, then register it again but after changing  form and add_form of 
UserAdmin with you custom form classes. Looking at the code for 
django.contrib.auth.admin will probably make things clearer for you:

http://code.djangoproject.com/browser/django/trunk/django/contrib/auth/admin.py



tristan wrote:
> In our webapp we needed to allow dashes "-" in our usernames. I've
> enabled that for the consumer signup process just fine with this regex
> r'^[\w-]+$'
>
> How can I tell the admin app so that I can edit usernames in auth >
> users to allows the "-" character in usernames?
> >
>   


--~--~-~--~~~---~--~~
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 need django.contrib.auth in my INSTALLED_APP when if I don't use the models from there?

2009-07-31 Thread Vasil Vangelovski

Thanks :)

Luke Seelenbinder wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> No, you would not. Hope that helps.
>
> Luke
>
> luke.seelenbin...@gmail.com
>
> "I [may] disapprove of what you say, but I will defend to the death your
> right to say it." -- Voltaire
>
>
> Vasil Vangelovski wrote:
>   
>> It's like this:
>> I actually have 3 projects. These projects share apps. So all the apps 
>> besides the third party ones are placed in one folder which is on 
>> PYTHONPATH. The third party ones are in another folder on the 
>> PYTHONPATH. Yes 2 of these projects use the admin and do use the 
>> ModelBackend for authentication, I have django.contrib.auth in 
>> INSTALLED_APPS for those 2.
>>
>> But this smaller project I'm asking about provides just a few views for 
>> a REST API. Now the calls to that REST service are made only by one 
>> application on the internal network which will have it's own 
>> username/password in the settings file. And this project doesn't use the 
>> admin or any of the models in django.contrib.auth (besides returning 
>> User from the authenticate method in the backend).
>>
>> So I guess I don't need django.contrib.auth in INSTALLED_APPS for that 
>> project.
>>
>> Luke Seelenbinder wrote:
>> Vasil,
>>
>> That will vary on what the apps you are using. If none of the apps
>> depend on django.contrib.auth, you won't need it, unless you want to use
>> the django admin (which depends on django.contrib.auth).
>>
>> To fully answer your question, we would need to know what apps it is using.
>>
>> Luke
>> luke.seelenbin...@gmail.com
>>
>> "I [may] disapprove of what you say, but I will defend to the death your
>> right to say it." -- Voltaire
>>
>>
>> Vasil Vangelovski wrote:
>>   
>> 
>>>>> I'm making a very small project that will use the apps/models from a 
>>>>> larger one. This will be hosted on a separate domain. Now the larger 
>>>>> project uses the models from django.contrib.auth, but I don't need and 
>>>>> don't want to store users in a database for this smaller one. I'll just 
>>>>> provide my own authentication backend that reads usernames and password 
>>>>> from a config file and uses Base64 authentication. Do I still need to 
>>>>> put django.contrib.auth in INSTALLED_APPS?
>>>>>
>>>>> 
>>>>>   
>
>   
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkpzjOQACgkQXQrGVCncjPysvQCcCXJrUwoK7pzgqp8LCh0BDby5
> VIsAn3rEh74fXv9xaAF0AOFO83rYJ0TW
> =K69Z
> -END PGP SIGNATURE-
>
> >
>   


--~--~-~--~~~---~--~~
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 need django.contrib.auth in my INSTALLED_APP when if I don't use the models from there?

2009-07-31 Thread Vasil Vangelovski

It's like this:
I actually have 3 projects. These projects share apps. So all the apps 
besides the third party ones are placed in one folder which is on 
PYTHONPATH. The third party ones are in another folder on the 
PYTHONPATH. Yes 2 of these projects use the admin and do use the 
ModelBackend for authentication, I have django.contrib.auth in 
INSTALLED_APPS for those 2.

But this smaller project I'm asking about provides just a few views for 
a REST API. Now the calls to that REST service are made only by one 
application on the internal network which will have it's own 
username/password in the settings file. And this project doesn't use the 
admin or any of the models in django.contrib.auth (besides returning 
User from the authenticate method in the backend).

So I guess I don't need django.contrib.auth in INSTALLED_APPS for that 
project.

Luke Seelenbinder wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Vasil,
>
> That will vary on what the apps you are using. If none of the apps
> depend on django.contrib.auth, you won't need it, unless you want to use
> the django admin (which depends on django.contrib.auth).
>
> To fully answer your question, we would need to know what apps it is using.
>
> Luke
> luke.seelenbin...@gmail.com
>
> "I [may] disapprove of what you say, but I will defend to the death your
> right to say it." -- Voltaire
>
>
> Vasil Vangelovski wrote:
>   
>> I'm making a very small project that will use the apps/models from a 
>> larger one. This will be hosted on a separate domain. Now the larger 
>> project uses the models from django.contrib.auth, but I don't need and 
>> don't want to store users in a database for this smaller one. I'll just 
>> provide my own authentication backend that reads usernames and password 
>> from a config file and uses Base64 authentication. Do I still need to 
>> put django.contrib.auth in INSTALLED_APPS?
>>
>> 
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkpziWMACgkQXQrGVCncjPxAVQCfb2PIkFzWgU5v2CGYe8oh5gG3
> vNUAnihZxM5r0KgJpAR7V0G+TrEFFETD
> =qJUh
> -END PGP SIGNATURE-
>
> >
>   


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Do I need django.contrib.auth in my INSTALLED_APP when if I don't use the models from there?

2009-07-31 Thread Vasil Vangelovski

I'm making a very small project that will use the apps/models from a 
larger one. This will be hosted on a separate domain. Now the larger 
project uses the models from django.contrib.auth, but I don't need and 
don't want to store users in a database for this smaller one. I'll just 
provide my own authentication backend that reads usernames and password 
from a config file and uses Base64 authentication. Do I still need to 
put django.contrib.auth in INSTALLED_APPS?

--~--~-~--~~~---~--~~
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: custom admin actions

2009-07-30 Thread Vasil Vangelovski

You can get the model class for the modeladmin, it's the model property. So
modeladmin.model will give you the model class. You can just do a
check of equality
modeladmin.model == OurModel.

On Thu, Jul 30, 2009 at 1:22 PM, selcukcihan wrote:
>
> Hi, i have django 1.1
>
> I have a user profile model, call it OurUser. I have defined a custom
> action, "send mail". This action is available in OurUser and django
> auth's User models. It is handled via a global function with this
> signature
>
> def send_mail_to_users(modeladmin, request, queryset):
>    selected = request.POST.getlist(admin.ACTION_CHECKBOX_NAME)
>    return HttpResponseRedirect(reverse('some view') + '?ids=%s' %
> ",".join(selected))
>
> This works well only for auth's User model(since it gets the correct
> ids). What i need is an if else of the form
> if modeladmin belongs to "User" then do something
> else if modeladmin belongs to "OurUser" then do something
>
> so that i can extract the User ids from OurUser and then redirect
> properly
> >
>

--~--~-~--~~~---~--~~
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:

2009-07-30 Thread Vasil Vangelovski

Hi

I've hacked up something quick which will work in most simple cases,
but I don't suggest you use the same code as it is. It's just to show
you an example of how this can be done. This is the html markup:

http://dpaste.com/hold/73500/

And this is the js with jquery:

http://dpaste.com/hold/73501/

On Thu, Jul 30, 2009 at 8:41 PM, Margie<margierogin...@yahoo.com> wrote:
>
> Hi Vasil,
>
> Could you clarify how I access the variable from the javascript?  For
> example, using my DateWidget as an example, say in my wdigets.py I
> have this (note I've added ?myVar='xyz' in second line:
>
> class DateWidget(widgets.DateInput):
>    class Media:
>        js = ("js/jquery.datePicker.min-2.1.2.js",
>               "js_custom/date_widget.js?myVar='xyz''")
>
> The complete contents of date_widget.js is currently:
>
>  $(document).ready(function() {
>                      Date.firstDayOfWeek = 0;
>                      Date.format = 'mm/dd/';
>                      $('.chipvision_date_widget').datePicker();
>                    });
>
> How do I access myVar from inside date_widget.js?
>
> I know the .js files listed in the Media class get output into my html
> via my inclusion of  {{ media }} in my template.  So I see that I get
> this in my html
>
> 
> 
>
> But I seem to have some missing piece - I don't get how to get access
> to xyz from the .js script itself.  Sorry if this is a dumb question -
> I've written various bits of javascript/jquery but haven't encountered
> this.
>
> Margie
>
>
>
> On Jul 29, 5:51 pm, Vasil Vangelovski <vvangelov...@gmail.com> wrote:
>> Of course that the files specified in the class Media are accessed via
>> GET. How else would they be accessed? It's possible to fetch a js file
>> with additional get arguments and access those values from the js. So
>> you can pass prePopulateString as a get parameter to the js file in
>> class Media for example:
>>
>> class Media:
>>    js = ('myAutoCompleteInit.js?prepopString=%s'%prePopulateString)
>>
>> Then pass that parameter to the js method you need inside 
>> myAutoCompleteInit.js.
>>
>> On Thu, Jul 30, 2009 at 1:53 AM, Margie<margierogin...@yahoo.com> wrote:
>>
>> >> There's no easy way of passing dynamic javascript in the Media class.
>> >> However, you can fake it, with a bit of work, by passing the parameter
>> >> to the script in a querystring. So, for example, in the list of js
>> >> files to be included you would have
>> >>     'js/myfile.js?renderclass=%s' % self.prePopulateString
>>
>> >> Then your js can find its own 

Re: Long Poll in Django

2009-07-30 Thread Vasil Vangelovski

I've used orbited with success for this purpose:
http://www.orbited.org/

But getting started integrating it with your django project is not
very straightforward.

On Thu, Jul 30, 2009 at 11:52 AM, aleph wrote:
>
> Hi!
>
> Is it possible to use Django with longpoll technique? What I mean is a
> client (probably Flex client) which sends a request to server and
> start recieving data 'forever' - until timeout or something. The
> django application on server has polling loop or some producer/
> customer threads inside -  it is receiving data from some side source
> and transmits it to client over HTTP.
>
> Is it possible are there any guidelines about it?
>
> Thank you very much,
> Ilya
>
> >
>

--~--~-~--~~~---~--~~
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: I need to get psycopg2 installed on Mac OS X 10.5

2009-07-30 Thread Vasil Vangelovski

There's a package of PostgreSQL called postgresplus that comes with
postgis, pgadmin etc. It's pretty easy to set up on os x:
http://www.enterprisedb.com/products/postgres_plus/overview.do
Installing psycopg2 after I've installed postgresplus has always
worked for me with minimum effort, see this:
http://blog.jonypawks.net/2008/06/20/installing-psycopg2-on-os-x/

--~--~-~--~~~---~--~~
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:

2009-07-29 Thread Vasil Vangelovski

Of course that the files specified in the class Media are accessed via
GET. How else would they be accessed? It's possible to fetch a js file
with additional get arguments and access those values from the js. So
you can pass prePopulateString as a get parameter to the js file in
class Media for example:

class Media:
   js = ('myAutoCompleteInit.js?prepopString=%s'%prePopulateString)

Then pass that parameter to the js method you need inside myAutoCompleteInit.js.



On Thu, Jul 30, 2009 at 1:53 AM, Margie wrote:
>
>
>>
>> There's no easy way of passing dynamic javascript in the Media class.
>> However, you can fake it, with a bit of work, by passing the parameter
>> to the script in a querystring. So, for example, in the list of js
>> files to be included you would have
>>     'js/myfile.js?renderclass=%s' % self.prePopulateString
>>
>> Then your js can find its own 

Re: Can I have custom validation in the admin change_list form when using ModelAdmin.list_editable?

2009-07-29 Thread Vasil Vangelovski

That works, thanx.

On Thu, Jul 30, 2009 at 12:07 AM, Alex Gaynor<alex.gay...@gmail.com> wrote:
>
> On Wed, Jul 29, 2009 at 5:05 PM, Vasil
> Vangelovski<vvangelov...@gmail.com> wrote:
>>
>> Is it possible to define custom validation for the form in the admin
>> change list when using ModelAdmin.list_editable?
>>
>> >
>>
>
> Yes, get_changelist_form, and get_changelist_formset:
> http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/options.py#L350
> can be used to provide custom forms.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your
> right to say it." -- Voltaire
> "The people's good is the highest law." -- Cicero
> "Code can always be simpler than you think, but never as simple as you
> want" -- Me
>
> >
>

--~--~-~--~~~---~--~~
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 save data into more than one table?

2009-07-29 Thread Vasil Vangelovski

What exactly do you need to do? Please be more specific.


On Wed, Jul 29, 2009 at 11:39 PM, Asinox wrote:
>
> Hi guys, i cant find a example about how ill save data in two or more
> tables... somebody help me please
>
> 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-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
-~--~~~~--~~--~--~---



Can I have custom validation in the admin change_list form when using ModelAdmin.list_editable?

2009-07-29 Thread Vasil Vangelovski

Is it possible to define custom validation for the form in the admin
change list when using ModelAdmin.list_editable?

--~--~-~--~~~---~--~~
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:

2009-07-29 Thread Vasil Vangelovski

> The way I do it is what you allude to at the end, have a special class
> on the inputs and then use the inner Media class of the widget
> (http://docs.djangoproject.com/en/dev/topics/forms/media/) to provide
> a javascript file that'll automatically add the widget to all of the
> items with that class.

Besides having less code this has another benefit, you keep your js
code in js files and outside of your html markup.

--~--~-~--~~~---~--~~
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: IDE for Django and Ext JS

2009-07-29 Thread Vasil Vangelovski

There's not much benefit in using an IDE like eclipse or netbeans for
Python and JS, they are also slow enough to counter productivity. I'd
rather waste those CPU cycles for playing random noises in the
background.

--~--~-~--~~~---~--~~
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: MS Word Characters

2009-07-28 Thread Vasil Vangelovski

Are you emailing just the rtf document you generate or sending the 
contents in the email body as well?

The problem might be that the content encoding of the rtf or email 
message is not set properly.

cootetom wrote:
> Hello,
>
> I'm having some trouble with strange characters that come from MS
> Word. User's are copying text from MS Word, pasting it into a textarea
> on the site. I then save that text into MySQL (table charset is set to
> utf-8). Then later I retrieve that data to create a RTF document then
> an email it to somebody. The problem is that a lot of characters from
> word aren't displaying correctly.
>
> Example an " will return \xe2\x80\x93 from the database. What type of
> encoding is that?
>
> I've tried running this through all sorts of encoding functions in
> python but haven't had any success, unicode, smart_unicode, decode &
> encode functions.
>
> My next guess would be that perhaps these strange characters need to
> be removed before they are saved to the database. Any ideas?
> >
>   


--~--~-~--~~~---~--~~
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 use form_class with generic views?

2009-07-27 Thread Vasil Vangelovski

First, of course you should separate that code, and form classes usually 
go in forms.py, models in models.py.
Second, you are getting a 'NoneType object is not callable' beacause of 
what you have in urls.py. Look at that carefully and you'll figure it out.


djangonoob wrote:
> oh by the way,
> i've tried your method and i received the error:
>
> 'NoneType' object is not callable
>
> May i know how do i solve this issue?
>
> Best Regards,
> Eugene
>
> On Jul 27, 12:15 pm, Vasil Vangelovski <vvangelov...@gmail.com> wrote:
>   
>> First you create a ModelForm:
>>
>> from django.forms import ModelForm
>> from myproject.myapp.models import MyModelClass
>>
>> class MyFormClass(ModelForm):
>> class Meta:
>> model = MyModelClass
>>
>> there you have your form_class that you need to pass to the view you want:
>>
>> ‘django.views.generic.create_update.update_object’,
>> dict(form_class=MyFormClass)
>>
>> see:
>>
>> http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#topics-...
>>
>> 
>>> Hi all,
>>> I am wondering how can i use form_class with generic views?
>>>   
>>> FOr example, according to the online 
>>> doc,http://docs.djangoproject.com/en/dev/ref/generic-views/
>>> we can use form_class as a required argument for create_object ,
>>> update_object, delete_object
>>>   
>>> But the online doc stopped short on how to use the form_class.
>>>   
>>> Is there anyone woh has a simple example on how to use form_class as a
>>> required argument for generic views?
>>>   
>>> Thanks alot!
>>>   
> >
>   


--~--~-~--~~~---~--~~
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 use form_class with generic views?

2009-07-26 Thread Vasil Vangelovski

First you create a ModelForm:

from django.forms import ModelForm
from myproject.myapp.models import MyModelClass

class MyFormClass(ModelForm):
class Meta:
model = MyModelClass

there you have your form_class that you need to pass to the view you want:

‘django.views.generic.create_update.update_object’,
dict(form_class=MyFormClass)

see:

http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#topics-forms-modelforms


> Hi all,
> I am wondering how can i use form_class with generic views?
>
> FOr example, according to the online doc, 
> http://docs.djangoproject.com/en/dev/ref/generic-views/
> we can use form_class as a required argument for create_object ,
> update_object, delete_object
>
> But the online doc stopped short on how to use the form_class.
>
> Is there anyone woh has a simple example on how to use form_class as a
> required argument for generic views?
>
> Thanks alot!
> >
>   


--~--~-~--~~~---~--~~
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: Url Namespaces

2009-07-26 Thread Vasil Vangelovski

See this:

http://docs.djangoproject.com/en/dev/topics/http/urls/#defining-url-namespaces

On Mon, Jul 27, 2009 at 12:13 AM, Vitaly Babiy wrote:
> How does one go about registering a namespace?
> I can't seem to find it in the docs.
> Thanks,
> Vitaly Babiy
>
> >
>

--~--~-~--~~~---~--~~
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: Sqlite3 ok from deployment?

2009-07-22 Thread Vasil Vangelovski

I don't think it really matters if one or more processes/threads try
to access it, when it get's locked EXCLUSIVE for writing only one will
have access to it until the lock gets released. For a very low volume
site with very few INSERT/UPDATE/DELETE queries you may not experience
any difference but if your site grows in the future you'll have to go
through migrating your data when you have to switch the db, which can
also be made pretty simple with django.
If there's a really small ammount of memory on your deployment server
sqlite might be a better option than something bigger (in that case
apache is not the best option either, try cherrypy wsgi server). But
if you have enough resources and the only real reason for using sqlite
is not wanting to go through db server installation you might want to
reconsider.

On Thu, Jul 23, 2009 at 2:02 AM, Some Guy wrote:
>
> Having finished a small app, i'm wondering if it's ok to use sqlite3
> in a deployment with mod_python and apache.
>
> I've read that sqlite is not meant for multi-user access where the
> actual db file is shared, but with several mod_pythons running will it
> be an issue if they are all having access to it? The site is low
> volume... should I run 1 max instances of mod_python?
>
> Is sqlite only meant for development? Django makes it pretty easy to
> change DBs so don't spare me the harsh truth ! :-)
> >
>

--~--~-~--~~~---~--~~
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: Java and Python

2009-07-22 Thread Vasil Vangelovski

You can certainly run django 1.0.2 in apache tomcat, jetty etc. See these:

http://docs.djangoproject.com/en/dev/howto/jython/
http://code.google.com/p/django-jython/

It's a bit slower  though (will fool anyone that it's a Java web app).


On Wed, Jul 22, 2009 at 11:58 PM, slypete wrote:
>
> Hi everyone,
>
> I'm looking for opinions on how to get Java and Python bidirectionally
> communicating . For example, I have a server written in Java that I'd
> like to have use my django model classes to insert database data and
> trigger events. In the other case, I'd like to call some java
> libraries I have when a user requests a page.
>
> For the first case, I'm interested in using jythonc. Has anyone had
> any success trying to compile django this way? If not, I suppose I
> could always resort to using the python interpreter; however, it would
> be nice to have this code compiled from the get go.
>
> In the second case, I'm not sure what to do at all. I looked at the
> PHP/Java bridge (don't let the name fool you), but it doesnt have very
> good documentation. I also had a look at JPype, but these dont seem to
> be the greatest solutions.
>
> My problem is, I don't know much about java servlets. Maybe I can just
> run django in a servlet engine like tomcat under Jython to get this
> working?
>
> Thanks for any help,
> Pete
>
> >
>

--~--~-~--~~~---~--~~
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: Ajax-based generic views?

2009-07-22 Thread Vasil Vangelovski

What exactly do you mean by "ajax-based generic views"? Most often
you'd return a JSON response to an xhr request so instead of passing a
dict as a context object to render_to_response you'd return an HTTP
response with the dict serialized as JSON. Follow any guidelines for
making views generic, but instead of filling the response with a
template rendered as html return the content serialized as JSON.
Simplejson comes with django, Also you can serialize model objects
automatically
http://docs.djangoproject.com/en/dev/topics/serialization/

On Wed, Jul 22, 2009 at 11:36 PM, djangonoob wrote:
>
> Hi all, i understand that this is a recurring topic.
> But i couldnt find any ajax-based generic views tutorials/threads,
> etc.
>
> How do we implement ajax-based generic views?
>
> BEst Rgds.
> >
>

--~--~-~--~~~---~--~~
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: Hi people

2009-07-22 Thread Vasil Vangelovski

A good place to start is the tutorial:

http://docs.djangoproject.com/en/dev/intro/tutorial01/

If you are new to python you can also check dive into python:

http://diveintopython.org/

On Wed, Jul 22, 2009 at 10:52 AM, sudharsan s wrote:
>
> Hi i am new to django . i have interest towrds programing..so i need
> some help how to start  with django i went through the official
> documentation of django and i also installed it.. after that i don
> know how to proceed
>
> >
>

--~--~-~--~~~---~--~~
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: Strange things happening with reverse url lookups

2009-07-21 Thread Vasil Vangelovski

Thanx

It was just my luck reading about this new feature in the URL
dispatcher and trying to use it in my project moments before it was
added to trunk :)

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Strange things happening with reverse url lookups

2009-07-21 Thread Vasil Vangelovski

I've posted a question about this a few days ago and I thought I was
confused about something, but it was probably some problem with the
django revision at the time or I'm even more confused now. So... I
have an application called epg with a model named Show and I want to
provide a link for editing an instance of this model on the admin.
Now, the django checkout on my laptop is a week old and the one on my
desktop was updated today, so this code:

reverse('admin_epg_Show_change', args = (id,))

works on my laptop but does not work on my desktop

and this code:

reverse('admin:epg_Show_change', args = (id,))

works on my desktop but doesn't work on my laptop

what's going on??? which one should I use??? What will stick in django
1.1 final??? Judging by the docs for the admin it should be the second
one, but I'm confused.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RequestContext current_app keyword argument

2009-07-17 Thread Vasil Vangelovski

Looking at the code for the ModelAdmin class in
django.contrib.admin.options I've come accross this:
context_instance = template.RequestContext(request,
current_app=self.admin_site.name)
in a few places. What is this current_app argument?
When I try to init a RequestContext with the current_app argument from
my code it fails saying that the __init__ method doesn't accept such
kwarg. What am I missing here?

--~--~-~--~~~---~--~~
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: A question about reverse url lookups for admin site in svn version

2009-07-17 Thread Vasil Vangelovski

Yeah, I was confused mostly about the stuff with the colon because I
didn't pay much attention when reading about namespaced urls the new
docs.

Thanks

On Fri, Jul 17, 2009 at 10:49 PM, Michael<newmani...@gmail.com> wrote:
> On Fri, Jul 17, 2009 at 4:27 PM, Vasil Vangelovski <vvangelov...@gmail.com>
> wrote:
>>
>> Sorry, it was probably my missunderstanding of some details in the
>> docs. I changed the initialization of my admin site so it doesn't have
>> a name and what I was trying to do works now. But anyway, if my admin
>> site was initialized like so site = MyAdminSite('admin') what code is
>> supposed to give me the url for it's index page?
>>
>> On Fri, Jul 17, 2009 at 9:48 PM, Vasil
>> Vangelovski<vvangelov...@gmail.com> wrote:
>> > Yes it does work, I've tried this with a brand new project in the same
>> > virtualenv. Reverese resolution of urls for the AdminSite in
>> > django.contrib.admin does work with the latest trunk revision.
>> > Here's simplest situation where I'm having a problem:
>> >
>> > I have an app called admin in my project which contains some
>> > templatetags and a subcalss of AdminSite, you can see the relevant
>> > code in this dpaste:
>> > http://dpaste.com/68309/
>> > The shell interaction is here:
>> > http://dpaste.com/68303/
>> > Note in my installed apps I have both my admin application and the
>> > admin app from django.contrib.
>> > The same shell interaction would work without a problem if I try it in
>> > another project where I use just django.contrib.admin.sites.AdminSite
>> > Note that changing the url regex for the admin from empty to
>> > r'^admin/' doesn't change anything, it's like that because the django
>> > project
>> > is just an admin site for a larger project done in Java/Flex.
>> > Thanks.
>
> Try reverse('admin:index ')
> The colon is the new namespaces that were just added to the django
> urlresolvers. Pretty exciting, huh?
> FYI the admin uses 'admin' as the default app instance. I am not sure what
> this will do if you have two apps that are named the same and try to
> reverse. It might just be unpredictable as to which URL is going to be
> returned or might throw an error. I am not sure. You might want to change
> that to something else.
> Hope that helps,
> Michael
> >
>

--~--~-~--~~~---~--~~
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: A question about reverse url lookups for admin site in svn version

2009-07-17 Thread Vasil Vangelovski

Sorry, it was probably my missunderstanding of some details in the
docs. I changed the initialization of my admin site so it doesn't have
a name and what I was trying to do works now. But anyway, if my admin
site was initialized like so site = MyAdminSite('admin') what code is
supposed to give me the url for it's index page?

On Fri, Jul 17, 2009 at 9:48 PM, Vasil
Vangelovski<vvangelov...@gmail.com> wrote:
> Yes it does work, I've tried this with a brand new project in the same
> virtualenv. Reverese resolution of urls for the AdminSite in
> django.contrib.admin does work with the latest trunk revision.
> Here's simplest situation where I'm having a problem:
>
> I have an app called admin in my project which contains some
> templatetags and a subcalss of AdminSite, you can see the relevant
> code in this dpaste:
> http://dpaste.com/68309/
> The shell interaction is here:
> http://dpaste.com/68303/
> Note in my installed apps I have both my admin application and the
> admin app from django.contrib.
> The same shell interaction would work without a problem if I try it in
> another project where I use just django.contrib.admin.sites.AdminSite
> Note that changing the url regex for the admin from empty to
> r'^admin/' doesn't change anything, it's like that because the django
> project
> is just an admin site for a larger project done in Java/Flex.
> Thanks.
>
>
> On Fri, Jul 17, 2009 at 4:46 PM, Michael<newmani...@gmail.com> wrote:
>> On Fri, Jul 17, 2009 at 10:28 AM, Vasil Vangelovski <vvangelov...@gmail.com>
>> wrote:
>>>
>>> I'm using svn trunk version of django (rev. #11263). In my project I
>>> have only one admin site registered in the urlconf. This admin site is
>>> a subcalss of django.contrib.admin.sites.AdminSite and is instantiated
>>> with the name 'admin'. I'm trying to use reverse url lookups for the
>>> admin site as described in the docs:
>>> http://docs.djangoproject.com/en/dev/ref/contrib/admin/#admin-reverse-urls
>>> But it doesn't work, I always get a NoReverseMatch exception.
>>> Can someone confirm that reverse url lookups for admin sites work as
>>> described in the docs with the latest trunk revision?
>>
>> I can confirm they work, but they were only checked in less than 48 hours
>> ago, so I would first double check and make sure you have the newest version
>> of the django svn. If you are all updated and it still doesn't work, posting
>> your admin site, model admin and where the urlreversing is happening, we can
>> help you.
>> Also, sometimes you can get a more helpful error message from the shell. The
>> reverse() function that you can use is available in
>> django.core.urlresolvers.
>> Let us know how it is going,
>> Michael
>> >>
>>
>

--~--~-~--~~~---~--~~
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: A question about reverse url lookups for admin site in svn version

2009-07-17 Thread Vasil Vangelovski

Yes it does work, I've tried this with a brand new project in the same
virtualenv. Reverese resolution of urls for the AdminSite in
django.contrib.admin does work with the latest trunk revision.
Here's simplest situation where I'm having a problem:

I have an app called admin in my project which contains some
templatetags and a subcalss of AdminSite, you can see the relevant
code in this dpaste:
http://dpaste.com/68309/
The shell interaction is here:
http://dpaste.com/68303/
Note in my installed apps I have both my admin application and the
admin app from django.contrib.
The same shell interaction would work without a problem if I try it in
another project where I use just django.contrib.admin.sites.AdminSite
Note that changing the url regex for the admin from empty to
r'^admin/' doesn't change anything, it's like that because the django
project
is just an admin site for a larger project done in Java/Flex.
Thanks.


On Fri, Jul 17, 2009 at 4:46 PM, Michael<newmani...@gmail.com> wrote:
> On Fri, Jul 17, 2009 at 10:28 AM, Vasil Vangelovski <vvangelov...@gmail.com>
> wrote:
>>
>> I'm using svn trunk version of django (rev. #11263). In my project I
>> have only one admin site registered in the urlconf. This admin site is
>> a subcalss of django.contrib.admin.sites.AdminSite and is instantiated
>> with the name 'admin'. I'm trying to use reverse url lookups for the
>> admin site as described in the docs:
>> http://docs.djangoproject.com/en/dev/ref/contrib/admin/#admin-reverse-urls
>> But it doesn't work, I always get a NoReverseMatch exception.
>> Can someone confirm that reverse url lookups for admin sites work as
>> described in the docs with the latest trunk revision?
>
> I can confirm they work, but they were only checked in less than 48 hours
> ago, so I would first double check and make sure you have the newest version
> of the django svn. If you are all updated and it still doesn't work, posting
> your admin site, model admin and where the urlreversing is happening, we can
> help you.
> Also, sometimes you can get a more helpful error message from the shell. The
> reverse() function that you can use is available in
> django.core.urlresolvers.
> Let us know how it is going,
> Michael
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



A question about reverse url lookups for admin site in svn version

2009-07-17 Thread Vasil Vangelovski

I'm using svn trunk version of django (rev. #11263). In my project I
have only one admin site registered in the urlconf. This admin site is
a subcalss of django.contrib.admin.sites.AdminSite and is instantiated
with the name 'admin'. I'm trying to use reverse url lookups for the
admin site as described in the docs:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#admin-reverse-urls
But it doesn't work, I always get a NoReverseMatch exception.
Can someone confirm that reverse url lookups for admin sites work as
described in the docs with the latest trunk revision?

--~--~-~--~~~---~--~~
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: Map events in space on a django app

2009-03-19 Thread Vasil Vangelovski

If you don't need any spatial related queries (although django people  
uses something like  that) you don't really need a spatial database.  
You can store geographic coordinates in either FloatFields or  
CharFields. Your question is more related to GoogleMaps API than django.

I'm assuming you only need to store points, not lines or shapes.

If you try out some google maps API examples you'll find out it's  
pretty straightforward to let users post geographic coordinates to you  
backend.  Publishing these coordinates on a map is even easier.

I don't think there's anything special in django.contrib.gis that you  
may use. Except if you want to use the geo admin (which is awesome  
btw) in that case you'll need to use a spatial database.

On Mar 20, 2009, at 1:29 AM, Alessandro wrote:

>
> On Fri, Mar 20, 2009 at 12:42 AM, Alex Gaynor  
>  wrote:
>
>>> I thought geo django is too much complex for what I need. I don't  
>>> need
>>> to calculate spatial areas, only to store the gps coordinates of a
>>> point and publish them in a google map, like django people does.
>>>
>
> I'm looking for some documentation, but it seems not too simple.
> it should be very easier if someone shared a sample simple app using
> django.contrib.gis
>
> -- 
> Alessandro Ronchi
> Skype: aronchi
> http://www.alessandroronchi.net
>
> SOASI Soc.Coop. - www.soasi.com
> Sviluppo Software e Sistemi Open Source
> Sede: Via Poggiali 2/bis, 47100 Forlì (FC)
> Tel.: +39 0543 798985 - Fax: +39 0543 579928
>
> Rispetta l'ambiente: se non ti è necessario, non stampare questa mail
>
> >


--~--~-~--~~~---~--~~
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: add https to django

2009-03-19 Thread Vasil Vangelovski

I'd recommend you use all the power of your webserver for this (apache
or nginx or whatever). There should be no specific modifications on
the django site if you do it right.

I think this gui has the fix for what you asked tho:
http://hotsyk.com/blog/2008/11/05/https-django-and-wsgi/

On Thu, Mar 19, 2009 at 3:30 PM, djanm...@gmail.com  wrote:
>
> Dear all,
>
> to add 'https' to my application, I followed this steps "http://
> www.djangosnippets.org/snippets/240/",
> and i add {ssl:true} to urls of admin,  but when from browser i acess
> to the http://ip:8000/admin/ i have redirection to https://ip:8000/admin/
> and not acess "transfert of data are interoppted"
> the error is  "  File "/usr/lib/python2.5/site-packages/django/core/
> servers/basehttp.py", line 603, in log_message
>    if self.path.startswith(self.admin_media_prefix) or self.path == '/
> favicon.ico':
> AttributeError: WSGIRequestHandler instance has no attribute 'path'  "
>
> Thank you for any help.
>
> >
>

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