Re: Re: RedirectView with query_string = True and urlencoded unicode string

2012-05-14 Thread Germán
Hi. Please excuse my ignorance in this affairs.

For an specific 
URI,
 
I have the following error

Traceback (most recent call last): 

 

File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", 
line 111, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/usr/local/lib/python2.6/dist-packages/django/views/generic/base.py", 
line 47, in view
   return self.dispatch(request, *args, **kwargs)

 File "/usr/local/lib/python2.6/dist-packages/django/views/generic/base.py", 
line 68, in dispatch
   return handler(request, *args, **kwargs)

 File "/usr/local/lib/python2.6/dist-packages/django/views/generic/base.py", 
line 151, in get
   url = self.get_redirect_url(**kwargs)

 File "/usr/local/lib/python2.6/dist-packages/django/views/generic/base.py", 
line 146, in get_redirect_url
   return url % kwargs

TypeError: not enough arguments for format string


The version I use is 1.3.1, and the urls.py line determining the 
redirection is

(r'^planes/((?P.*))', 
RedirectView.as_view(url='/tmovil/planes/%(anything)s', query_string=True)),


Is it possible the bug reported in ticket 
16842is cause for this error? If 
not, should I file a bug?

Thanks

On Saturday, August 13, 2011 12:47:30 AM UTC-4, Karen Tracey wrote:
>
> On Thu, Aug 11, 2011 at 10:48 AM, Slafs  wrote:
>
>> Should i report a ticket?
>>
>
> Yes please, that's a bug in Django.
>
> Karen
> -- 
> http://tracey.org/kmt/
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/SebYILZBuMAJ.
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: Form Wizard usable with branching?

2012-08-06 Thread Germán
Hi @mtnhiker.

I ran into very similar problems and spent weeks dealing with a View class 
based on Django-1.4's 
django.contrib.formtools.wizard.views.SessionWizardView. It was so much 
customization that some things started to go wrong and debugging was awful.

I came up with this solution:
https://gist.github.com/3098817 and https://gist.github.com/3080251

Let me know if it works for you.

PS: Related question in 
stackoverflow.com
.

On Saturday, August 4, 2012 12:01:25 AM UTC-4, mtnhiker wrote:
>
> Answering my own question...
>
> I debugged my brain a bit and got something working with branching.  
> Here's my interpretation of my brain bug.
>
> First a "step" is not something attached to a particular form.  Its the 
> index in a sequence.  The same form might be step 2 with one branching 
> structure but step 3 for another.
>
> Second, the "condition_dict" keyword to wizard.as_view() should be thought 
> only as "use or don't use" a form. For me, this mean I had to stop thinking 
> of how to make the wizard go from one node to another in a flow chart.  Its 
> as if all nodes in a flow chart are possible and the condition_dict is used 
> to look up-stream in the flow-chart to decide if a particular node (form) 
> should be used.
>
> I still would like to be able to design a wizard as a flow chart wtih 
> branches that switch based upon field values. I'd like to do this very 
> directly.  Perhaps I will write a django contrib that effectively tales 
> input as a directed-graph that represents the flow chart, and generates the 
> right condition_dict to make it happen.  (but first I have an app to build)
>
> On Friday, August 3, 2012 7:27:03 PM UTC-7, mtnhiker wrote:
>>
>> I think I must be missing something. To me a wizard should provide 
>> questions and branch according to the answers (otherwise why not just put 
>> it all in one form?).  I've searched the docs and web and source, but I 
>> don't find anything that lets me branch.  I thought the "condition_dict" of 
>> the wizard view would do the trick.  Seems not.
>>
>> Using the condition_dict can say when a step should be skipped.  But this 
>> isn't the same as jumping to a specific step.
>>
>> What I really want is to (somewhere!) check the values of a form right 
>> after the user hit "submit". Based on those values, jump to the next 
>> appropriate form.
>>
>> What is broken in my thinking about this?  Are people actually writing 
>> wizards with 1.4 that use the form wizard and do branching?
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/LU9vMm8Pa-gJ.
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: Nullable User email

2012-08-07 Thread Germán
It seems you shouldn't use null but rather an empty string:
https://docs.djangoproject.com/en/dev/ref/models/fields/#null

> Avoid using 
> null
>  on 
> string-based fields such as 
> CharField
>  and 
> TextField
>  unless 
> you have an excellent reason. If a string-based field has null=True, that 
> means it has two possible values for “no data”: NULL, and the empty 
> string. In most cases, it’s redundant to have two possible values for “no 
> data;” Django convention is to use the empty string, not NULL.



On Tuesday, August 7, 2012 11:08:50 AM UTC-4, Demian Brecht wrote:
>
> In an authentication backend I'm currently writing, I've supplied a custom 
> User model that extends the contrib.auth User model. I have the need to 
> allow email addresses to be NULL. 
>
> A little context: I'm writing an OAuth2 wrapper for an OAuth2 client I 
> relatively recently wrote (yes, I know that there are other clients already 
> written out there, but I'm writing this one due to being quite partial to 
> my module ;)). Some OAuth2 providers don't provide user e-mail addresses, 
> regardless of scope params. All providers however, provide some form of a 
> user ID. As you can't simply use field hiding in Django models, I figure 
> that I can achieve this by one of the following two methods:
>
> 1. Copy/paste the entire model, changing the attribute of the one field.
> 2. User._meta.fields[4].null = true
>
> #2, even though seemingly hacky at best seems to be the lesser of the two 
> evils as it at least keeps things DRY (and is potentially far less 
> maintenance down the road).
>
> My question is, is there another method of achieving this that I'm not 
> seeing? Preferably one that *isn't* hacky?
>
> Thanks,
> Demian
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/jJNvP6ETRAsJ.
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: Migrating app from Django 1.3.3 to 1.4

2012-08-07 Thread Germán
What other applications/extensions are you using? I remember a similar 
problem using debug-toolbar. I had to upgrade it to a newer revision (can't 
remember if the necessary changes were already contained in a release).

On Tuesday, August 7, 2012 10:24:06 AM UTC-4, dokondr wrote:
>
> Hi all!
> I am trying to run ConceptNet (
> http://csc.media.mit.edu/docs/conceptnet/install.html) originally 
> deployed on Django 1.3.
> When running this app with Django1.4 on Mac OS X 10.6.8. (Snow Leopard) I 
> get:
>
> "ImproperlyConfigured: settings.DATABASES is improperly configured. Please 
> supply the ENGINE value. Check settings documentation for more details."
>
> (Please see detailed log at the end of this message.)
>
> To solve this I tried to create new config for 1.4 and run with SQLite 
> database (ready to use) in my work directory.  I have changed the old 
> contents of 'db_config.py'
>
> DB_ENGINE = "sqlite3"
> DB_NAME = "ConceptNet.db"
> DB_HOST = ""
> DB_PORT = ""
> DB_USER = ""
> DB_PASSWORD = ""
> DB_SCHEMAS = ""
>
> to new format for 1.4 in the same file ('db_config.py") :
>
> DATABASES = {
>'default': {
> 'ENGINE': 'django.db.backends.sqlite3', # Add 
> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3'\
>  or 'oracle'.
> 'NAME': 'ConceptNet.db',  # Or path to 
> database file if using sqlite3.
> 'USER': '',  # Not used with sqlite3.
> 'PASSWORD': '',  # Not used with sqlite3.
> 'HOST': '',  # Set to empty string for localhost. Not 
> used with sqlite3.
> 'PORT': '',  # Set to empty string for default. Not 
> used with sqlite3.
> }
> }
>
> This did not help.
> I also renamed 'db_config.py' to 'settings.py' in the same working 
> directory. I am still getting the same error.
> What shall I do to make Django 1.4 find my configuration?
>
> Thanks!
> Dmitri
>
> - Detailed dump ---
>
> -bash: ipyhton: command not found
> >ipython
> Leopard libedit detected.
> Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
> Type "copyright", "credits" or "license" for more information.
>
> IPython 0.10 -- An enhanced Interactive Python.
> ? -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help  -> Python's own help system.
> object?   -> Details about 'object'. ?object also works, ?? prints more.
>
> In [1]: from conceptnet.models import Concept
> /Library/Python/2.6/site-packages/django/conf/__init__.py:75: 
> DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use 
> STATIC_URL instead.
>   "use STATIC_URL instead.", DeprecationWarning)
> /Library/Python/2.6/site-packages/matplotlib-0.91.1-py2.6-macosx-10.6-universal.egg/pytz/tzinfo.py:5:
>  
> DeprecationWarning: the sets module is deprecated
>   from sets import Set
>
> In [2]: dog = Concept.get('dog', 'en')
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (47, 0))
>
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (17, 0))
>
> ---
> ImproperlyConfigured  Traceback (most recent call last)
>
> /Users/user/wks/Macys/ConceptNet/ConceptNet-sqlite/ in 
> ()
>
> /Library/Python/2.6/site-packages/conceptnet/models.pyc in get(cls, text, 
> language, auto_create)
> 611 """
> 612 if not isinstance(language, Language):
> --> 613 language = Language.get(language)
> 614 surface = SurfaceForm.get(text, language, auto_create)
> 615 if surface is None:
>
> /Library/Python/2.6/site-packages/conceptnet/corpus/models.pyc in get(id)
> 103 """
> 104 if isinstance(id,Language): return id
> --> 105 return get_lang(id)
> 106 
> 107 @property
>
> /Library/Python/2.6/site-packages/django/utils/functional.pyc in 
> wrapper(*args)
>  25 if mem_args in cache:
>  26 return cache[mem_args]
> ---> 27 result = func(*args)
>  28 cache[mem_args] = result
>  29 return result
>
> /Library/Python/2.6/site-packages/conceptnet/corpus/models.pyc in 
> get_lang(lang_code)
>  65 it doesn't have to be looked up again.
>  66 """
> ---> 67 return Language.objects.get(id=lang_code)
>  68 get_lang = memoize(get_lang, cached_langs, 1)
>  69 
>
> /Library/Python/2.6/site-packages/django/db/models/manager.pyc in 
> get(self, *args, **kwargs)
> 129 
> 130 def get(self, *args, **kwargs):
> --> 131 return self.get_query_set().get(*args, **kwargs)
> 132 
> 133 def get_or_create(self, **kwargs):
>
> /Library/Python/2.6/site-packages/django/db/models/quer

Re: Using success_url with reverse() in class-based generic view

2012-09-26 Thread Germán
Just for the record.

Since Django 1.4, the best way to set up success_url in class-based generic 
views with url names is:

> success_url = reverse_lazy('my_url_name')


On Wednesday, September 21, 2011 4:53:56 PM UTC-3, Xavier Ordoquy wrote:
>
> Hi,
>
> You can also use get_success_url for that:
>
> class ContactView(generic.FormView):
> form_class = ContactForm
>
> def get_success_url(self):
> return reverse('contact-sent')
>
> Regards,
> Xavier
>
> Linovia.
>
> Le 21 sept. 2011 à 00:08, Daniel P a écrit :
>
> > Same problem. You'r not alone!
> > 
> > this is also a solution: http://djangosnippets.org/snippets/2445/
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Django users" group.
> > To post to this group, send email to django...@googlegroups.com
> .
> > To unsubscribe from this group, send email to 
> django-users...@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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/bm1tU2fvPAAJ.
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: Using email instead of username for registration and login

2012-09-26 Thread Germán
I opted to customize a little.

First the backend:

from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User


class EmailBackend(ModelBackend):
"""A django.contrib.auth backend that authenticates the user based on its
email address instead of the username.
"""

def authenticate(self, email=None, password=None):
"""Authenticate user using its email address instead of username."""
try:
user = User.objects.get(email=email)
if user.check_password(password):
return user
except User.DoesNotExist:
return None

Then setup settings accordingly (notice that I wrote the backend inside an 
app called 'accounts'):

AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend', # necessary for django.auth
'accounts.backends.EmailBackend' # custom backend to authenticate using the 
email field
)

And then modify your login view:

if request.method == 'POST' and username and password:
user = auth.authenticate(username=username, password=password)
if user is None:
user = auth.authenticate(email=email, password=password)

What do you think? I know it is not that simple but I couldn't figure out 
an easier/cleaner way to do it.

On Monday, September 24, 2012 10:57:20 PM UTC-3, Bill Beal wrote:
>
> Hi all,
>
> I want to use the email address as the username for registration and 
> login.  I'm using django-registration for 2-stage registration.  I'm 
> looking for an easier way than what I've come up with so far.  I can modify 
> registration and activation, but then django.contrib.auth.views.login has a 
> 30-character limit on the username.  I'm not looking forward to making 
> username act like an email address.  Any quick fixes?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/S6IA5wIf6FQJ.
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: Using success_url with reverse() in class-based generic view

2012-09-26 Thread Germán
Indeed

On Wednesday, September 26, 2012 2:45:32 PM UTC-3, Kurtis wrote:
>
> Sometimes, though, you may need to pass variables to a success url. In 
> that case, I'd use the "get_success_url" method so you can access the 
> 'self' attributes.
>
> On Wed, Sep 26, 2012 at 1:32 PM, Germán 
> > wrote:
>
>> Just for the record.
>>
>> Since Django 1.4, the best way to set up success_url in class-based 
>> generic views with url names is:
>>
>>> success_url = reverse_lazy('my_url_name')
>>
>>
>> On Wednesday, September 21, 2011 4:53:56 PM UTC-3, Xavier Ordoquy wrote:
>>
>>> Hi,
>>>
>>> You can also use get_success_url for that:
>>>
>>> class ContactView(generic.FormView):
>>> form_class = ContactForm
>>>
>>> def get_success_url(self):
>>> return reverse('contact-sent')
>>>
>>> Regards,
>>> Xavier
>>>
>>> Linovia.
>>>
>>> Le 21 sept. 2011 à 00:08, Daniel P a écrit :
>>>
>>> > Same problem. You'r not alone!
>>> > 
>>> > this is also a solution: 
>>> > http://djangosnippets.org/**snippets/2445/<http://djangosnippets.org/snippets/2445/>
>>> > 
>>> > -- 
>>> > You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> > To post to this group, send email to django...@googlegroups.com.
>>> > To unsubscribe from this group, send email to django-users...@**
>>> googlegroups.com.
>>>
>>> > For more options, visit this group at http://groups.google.com/**
>>> group/django-users?hl=en<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 view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/bm1tU2fvPAAJ.
>>
>> To post to this group, send email to django...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> django-users...@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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/NkYFZU8B5MkJ.
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: Update Services for Django

2012-09-26 Thread Germán
You could create some methods that ping an specific URL. Then you could 
subscribe/connect to the specific signals associated to what you want to 
report.

On Wednesday, September 26, 2012 12:14:46 PM UTC-3, Tom wrote:
>
> Hi All,
>
> Wordpress has something called Update Services, a feature that pings 
> certain web services when content is created or updated.
>
> http://codex.wordpress.org/Update_Services
>
> Does Django happen to have anything similar? What I'm trying to achieve is 
> a way to tell a remote server that a piece of content has either been 
> created, updated, or deleted.
>
> Many thanks for any advice or suggestions,
>
> Tom
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/j6kQ76K1gQYJ.
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 change the representation of newline?

2011-12-12 Thread Germán
Has anybody solved this issue?

On Dec 14 2006, 2:47 pm, "Aidas Bendoraitis"
 wrote:
> I ran out of ideas. :) Maybe somebody else has any thoughts regarding new 
> lines?
>
> Good luck with Django!
> Aidas Bendoraitis [aka Archatas]
>
> On 12/14/06, zhongke chen  wrote:
>
>
>
>
>
>
>
> > firefox shows utf-8
>
> > my firefox is 2.0
>
> > On 12/14/06, Aidas Bendoraitis  wrote:
> > > And what encoding is showed in the page info? ...when you right click
> > > somewhere in the page and choose "View Page Info" from the menu. Maybe
> > > just the default character encoding in your firefox settings is set
> > > wrongly?
>
> > > You can always override admin templates copying them into your
> > > custom_templates/admin directory.
>
> > > Regards,
> > > Aidas Bendoraitis
>
> > > On 12/14/06, zhongke chen  wrote:
> > > > It's not my html page, but the django admin page.
>
> > > > the head of admin page is like this:
>
> > > >  > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> > > > http://www.w3.org/1999/xhtml"; lang="zh-cn" 
> > > > xml:lang="zh-cn" >
> > > > 
> > > > 站点管理员
> > > >  > > > href="/oj/adminmedia/css/dashboard.css" />
> > > > 
>
> > > > no encoding here, but lang = 'zh-cn'.
>
> > > > and all chinese characters in my pages and mysql are encoded in UTF-8.
> > > > Locale of my server is like this:
>
> > > > LANG=zh_CN.UTF-8
> > > > LANGUAGE=zh_CN:zh:en_US:en
> > > > LC_CTYPE="zh_CN.UTF-8"
> > > > LC_NUMERIC="zh_CN.UTF-8"
> > > > LC_TIME="zh_CN.UTF-8"
> > > > LC_COLLATE="zh_CN.UTF-8"
> > > > LC_MONETARY="zh_CN.UTF-8"
> > > > LC_MESSAGES="zh_CN.UTF-8"
> > > > LC_PAPER="zh_CN.UTF-8"
> > > > LC_NAME="zh_CN.UTF-8"
> > > > LC_ADDRESS="zh_CN.UTF-8"
> > > > LC_TELEPHONE="zh_CN.UTF-8"
> > > > LC_MEASUREMENT="zh_CN.UTF-8"
> > > > LC_IDENTIFICATION="zh_CN.UTF-8"
> > > > LC_ALL=
>
> > > > On 12/13/06, Aidas Bendoraitis  wrote:
> > > > > It might be that it treats new lines as \r\n when you are using some
> > > > > windows-* encoding for your html pages. Check the source code. I would
> > > > > rather use UTF-8 in any case.
>
> > > > > Regards
> > > > > Aidas Bendoraitis [aka Archatas]
>
> > > > --
> > > > Yours, Zhongke Chen 陈忠克
>
> > --
> > Yours, Zhongke Chen 陈忠克
>
> > 欢迎访问温州本地Linux论坛:http://groups.google.com/group/linux-wz
>
> > 请用czk19790...@gmail.com与我联系,本人其它的邮箱已不再使用。如果要发word/excel/ppt文件给我,请先转成PDF格式。谢谢!PLEASE
> > contact me using czk19790...@gmail.com from now on. Other mail boxes
> > have been deprecated. If you want to attach word/excel/powerpoint
> > files for me, PLEASE convert them to pdf. Thanks a lot.

-- 
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 + Bamboo

2013-08-27 Thread Germán
Daniel, any luck with Bamboo?

On Friday, April 19, 2013 3:25:52 AM UTC-3, daniel.franca wrote:
>
> Anyone has any experience configuring Django with Bamboo for deployment 
> and tests?
> I'm trying to setup an environment, but there's not much about how to make 
> this work.
>
> What's is the best approach? cloud or local server?
> Is it better to work with simple bash scripts or you recommend some other 
> tools?
>
>
> Best,
> -- 
> Daniel França,
> about.me/danielfranca
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: What is the best way to have multiple admin users with there own models?

2013-09-06 Thread Germán
If I understood your question correctly, you want to create an additional 
admin site i.e. have more than one admin site, each one in different URLs. 
This is absolutely possible with stock Django, no need to copy directories 
or anything like that.

What you need is to create another instance of AdminSite, or a custom 
subclass of it, should you need to do so.
https://docs.djangoproject.com/en/1.5/ref/contrib/admin/#django.contrib.admin.AdminSite

On Thursday, September 5, 2013 10:28:38 PM UTC-5, Surgemcgee wrote:
>
> Ok, never mind. I copied the entire admin dir to the app directory and it 
> is working fairly well here. So naa..
>
>
> On Thu, Sep 5, 2013 at 11:15 PM, Robert Steckroth 
> 
> > wrote:
>
>> The application being created requires client to have an admin interface 
>> specific to external
>> application/use. In other words, I would like to provide unique Admin 
>> model control for a tentative user base. Any thoughts on how one might go 
>> about this? Thanks
>>
>> -- 
>>  Systems/Software Engineer
>>
>>
>>
>>  
>
>
> -- 
>  Systems/Software Engineer
>
>
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Error when using python magic in the Django environment

2013-09-06 Thread Germán
Are you sure you are running the *exact same python interpreter*? Are you 
using virtual environments?

On Friday, September 6, 2013 3:39:11 PM UTC-5, Edmond Murphy wrote:
>
> Running:
>
>- Python version 2.7.3
>- Django version 1.5.2
>
> I have a django view that indirectly makes use of python's magic library 
> (basically a ctypes wrapper with access to libmagic) which results in the 
> following error
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib/python2.7/dist-packages/magic.py", line 170, in load
> return _load(self._magic_t, filename)
> ArgumentError: argument 2: : expected CString 
> instance instead of str
>
> In isolation the error is repeatable using the following steps:
>
> ./manage.py shell
> >>> import magic
> >>> m = magic.open(magic.MAGIC_NONE)
> >>> m.load("/usr/share/file/magic.mgc")
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib/python2.7/dist-packages/magic.py", line 170, in load
> return _load(self._magic_t, filename)
> ArgumentError: argument 2: : expected CString 
> instance instead of str
>
>
> Issuing the same commands from a standard python shell does not result in 
> the same error
>
> Python 2.7.3 (default, Jan  2 2013, 13:56:14) 
> [GCC 4.7.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import magic
> >>> m=magic.open(magic.MAGIC_NONE)
> >>> m.load("/usr/share/file/magic.mgc")
> 0
>
> Google searches for the extact typeerror have proved useless, I even 
> attempted to modify magic.py and cast the filename with a 
> ctypes.create_string_buffer() call (AFAIK there is no ctypes.CString type) 
> but that still failed.
>
> The same code works fine running
>
>- Python v. 2.7.3
>- Django v. 1.4.3
>
> I am at a loss so I turn to you "django-users" for help
>
> Thanks in advance
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to redorder app

2013-09-06 Thread Germán
If you mean reordering *apps*, as in which order the different apps are 
arranged, I think there is no simple way.

Reorder the models for an specific app ? Same answer.

On Friday, September 6, 2013 3:16:59 AM UTC-5, Ranjith Kumar wrote:
>
> Hello,
> I trying to reorder the app in django admin, is there anyways we can do it 
> via admin.py?
>
> Thank you!
>
> -- 
> Cheers,
> Ranjith Kumar K,
> Chennai.
>
> http://ranjithtenz.wordpress.com
>
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: SimpleLazyObject for request.user not correctly evaluated inside RequestContext

2013-09-06 Thread Germán
What DB engine are you using? If it is PostgreSQL, you need to roll back 
the transaction after a database error exception (e.g. IntegrityError).

By the way, I think what you are doing is wrong. If the form data is 
invalid, then you need to call . form_invalid

On Friday, September 6, 2013 11:41:34 AM UTC-5, giovanni allegri wrote:
>
> I've opened a new thread, which relates to a previous 
> onefrom me.
> Digging into a wired behaviour in a FormView I've arrived to the following 
> problem:
>
>  - In my "form_valid" method I need to manage exceptions situations.
>  - In case of an exception I want to pass the response flow to an external 
> method, in an other module
>  - This external method returns a "render_to_response", in which I also 
> pass a RequestContext instance built from the "FormView.request" object.
>
> Sometihng like this (I past a simplified version)
>
> class ProjectCreateView(FormView):
>
> def form_valid(self, form):
> try:
> 
> except IntegrityError as e:
> return render_error(_('A project with the same title already 
> exists'),self.request)
>
> def render_error(msg,request):
> #__dummy__ = request.user.is_authenticated()
> data = {'error':{'msg':msg}}
> return 
> render_to_response('generic_error.html',data,context_instance=RequestContext(request))
>
> This causes a DatabaseError, because it crashes when it reaches the 
> user.is_authenticated template variable. The crashed seems to be caused 
> because of the SimpleLazyObject around the User instance. It seems it's not 
> correctly setup, or whatelse... I don't know.
>
> This problem disappears if I use the __dummy__ variable in the previous 
> snippet.
> This call seems to make the SimpleLazyObject "prepared" for later calls 
> (within the context processors).
>
> Why does this happen???
> It never happens in other view and generic views I'm using in my project. 
> What's wrong with the form view?
>
> Notice that 
>
> 1 - the same happens even if I set self.template_name and call 
> self.render_to_response.
> 2 - it doesn't happen during the normal form view workflow
>
> Giovanni
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Query executed two times in database (django 1.4, oracle 11g)

2013-09-07 Thread Germán
I'm not familiar with caching internals but perhaps the fact that you are using 
`raw` has something to do with your problem?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Create and save records through ManyToManyField selection.

2013-09-08 Thread Germán
You need to register the admin classes defined in admin.py. If you don't know 
how, go over the official tutorial in Django's online docs.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: bad request 400

2013-09-08 Thread Germán
If you don't post your code it's quite difficult to help you

On Sunday, September 8, 2013 3:34:33 PM UTC-5, Marcin Szamotulski wrote:
>
> Hello, 
>
> I start working on a new app.  I started in the usual way (with 
> django-admin.py startproject, configured the settings (nothing special 
> though) and when I try to use my first view function I always get: 
> [08/Sep/2013 21:32:31] "GET / HTTP/1.1" 400 26 
>
> (BAD REQUEST) 
>
> I reviewed my settings which are almost the default ones and could not 
> find anything special.  Any ideas how to go through this.  I also run 
> django on pdb but I could not find anything leaeding to this error. 
>
> Thanks for help, 
> Marcin 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: custom signup form

2013-09-08 Thread Germán
Anil, please beware that there are lots of code posted on the internet, 
many of which are faulty or at least don't follow best or standard 
practices. Copy & pasting will bite you, sooner or later. I recommend you 
to go over the (excellent) documentation of Django before actually working 
with some feature/topic of the framework.

Cheers

On Sunday, September 8, 2013 12:41:06 PM UTC-5, Anil wrote:
>
> class SignupForm(forms.ModelForm):
> class Meta:
> model = User
> fields = ["username", "mail", "password"]
>  
> def clean_password(self):
> password = self.cleaned_data.get("password")
> return password
>
> def save(self, commit=True):
> user = super(SignupForm, self).save(commit=False)
> print user, type(user)
> user.set_password(self.cleaned_data["password"])
> if commit:
> user.save()
> return user
>
> I copied this from some other site.
>
> On Sep 8, 2013, at 10:39 AM, Jonathan Baker 
> > 
> wrote:
>
> Can you post your entire SignupForm class? I think a bit more context will 
> help me diagnose.
>
>
> On Sun, Sep 8, 2013 at 11:27 AM, Anil Jangity  >wrote:
>
>> I tried that too earlier.
>>
>> I added these to the SignupForm class:
>>
>> def clean_password(self):
>> password = self.cleaned_data.get("password")
>> return password
>>
>> def save(self, commit=True):
>> user = super(SignupForm, self).save(commit=False)
>> user.set_password(self.cleaned_data["password"])
>> if commit:
>> user.save()
>> return user
>>
>> That throws this exception:
>> AttributeError: 'User' object has no attribute 'set_password'
>>
>>
>> On Sep 8, 2013, at 10:06 AM, Jonathan Baker 
>> > 
>> wrote:
>>
>> You need to run the password through the 'set_password' method of the 
>> User class to hash it. See: 
>> https://docs.djangoproject.com/en/1.0/topics/auth/#django.contrib.auth.models.User.set_password
>>
>> Hope this helps,
>> JDB
>>
>>
>> On Sun, Sep 8, 2013 at 11:02 AM, Anil Jangity 
>> > wrote:
>>
>>> New to Django.
>>> When I submit a signup form with this, the password is human readable in 
>>> the database. It seems like it should be hashed?
>>> Looking at some Google pages, it seems I need to 
>>> subclass UserCreationForm. 
>>>
>>> I tried that instead of forms.ModelForm and now it complains my form 
>>> doesn't have "password1" and "password2"; which is not what I want. I just 
>>> want a single password field.
>>>
>>> Can someone give me pointers on how I should go about this?
>>>
>>> Thanks!
>>>
>>>
>>> Models:
>>> class User(models.Model):
>>> name = models.CharField(max_length=32)
>>> username = models.CharField(max_length=16, primary_key=True)
>>> mail = models.EmailField(max_length=254)
>>> password = models.CharField(max_length=64)
>>> status = models.CharField(max_length=32)
>>> create_tstamp = models.DateTimeField(auto_now_add=True)
>>>
>>> def __unicode__(self):
>>> user = "%s: %s, %s" % (self.username, self.mail, self.name)
>>> return user
>>>
>>> class SignupForm(forms.ModelForm):
>>> class Meta:
>>> model = User
>>> fields = ["username", "mail", "password"]
>>>
>>>
>>> View:
>>> def signup(request):
>>> if request.POST:
>>> form = SignupForm(request.POST)
>>> if form.is_valid():
>>> newUser = form.save()
>>> return HttpResponseRedirect(reverse('dashboard'))
>>> else:
>>> form = SignupForm()
>>> return render(request, "registration/signup.html", {'form': form,})
>>>
>>>
>>> I am using Bootstrap and here is my signup.html for reference:
>>>
>>> 
>>> {% csrf_token %}
>>> Signup for Globexch account
>>> It's free. You can also Login.
>>>
>>> {% if form.username.errors %}
>>> {{ form.username.errors|join:", 
>>> " }}
>>> {% endif %}
>>> >> form.username.value %}value="{{ form.username.value }}" {% endif %} 
>>> class="input-block-level" placeholder="Login name">
>>>
>>>
>>> {% if form.mail.errors %}
>>> {{ form.mail.errors|join:", " 
>>> }}
>>> {% endif %}
>>> >> form.mail.value %}value="{{ form.mail.value }}" {% endif %} 
>>> class="input-block-level" placeholder="us...@example.com ">
>>>
>>>
>>> {% if form.password.errors %}
>>> {{ form.password.errors|join:", 
>>> " }}
>>> {% endif %}
>>> >> class="input-block-level" placeholder="Password">
>>>
>>> Let me 
>>> in
>>> 
>>>
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com .
>>> To post to this group, send email to django...@googlegroups.com
>>> .
>>> Visit this group at http://groups.google.com/group/django-users.
>>> For more o

Re: Forms template renders 'bad' html

2013-09-08 Thread Germán
Please post the code in question so someone can help you out.

If you are having doubts with the tutorial, you may check 
https://github.com/glarrain/django-tutorial-source-code

On Sunday, September 8, 2013 8:42:45 AM UTC-5, qdinthialand wrote:
>
> I'm new to Django, working through the Polls tutorial with the old 
> Test-Driven Django tutorial, where you're looking for specific field names 
> and values and such. Anyway, to keep it short, I noticed this in a Show 
> Page Source:
>
>
> 
>  value='Nb1aC7FaZ1lKn8F4JvmA1OEUr3L6ATil' />
>
>  value="5" />
> Very awesome
>
>  value="6" />
> Quite awesome
>
>  value="7" />
> Moderately awesome
>
> 
> 
>
> Note the id=choice#  - there's a double quote out of position - between 
> the 'choice' and the number. This throws quoted text off for the rest of 
> the form (and after). With colors, the error is obvious.
>
> This is Django 1.5.2
>
> Is this a bug? A known bug being tracked and or fixed? I can't make heads 
> or tails out of the bug tracking site - at least I couldn't find anything 
> from my searches.
>
> What should I do about this? (I mean, my life goes on irregardless - I'll 
> work around it). Is there a way to determine if this is a known issue, or 
> should this be reported, or what?
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Test using different database

2013-09-08 Thread Germán
Antony.

Developers using different database engines is a very bad practice and WILL 
cause you troubles sooner or later.

I don't get something from your question: are both engines supposed to be 
used at the same time or do you want to select a specific one to runt the 
test suite?

On Friday, July 26, 2013 8:45:02 AM UTC-5, Antony wrote:
>
> Hi,
>
> I have two databases on my settings file. One is sqlite and the other is 
> postgis. It is a big project so some developers use sqllite and a few are 
> using postgis. 
> Now, when I try ./manage.py test command, I get the following,
>
>
> 
> Creating test database for alias 'default'...
> AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'
>
> -
>
> Is there a way to issue a command that contains the alias for the postgis 
> database? I am looking for something like " ./manage.py test 
> --database='spatial_db' " or similar. I have been looking around 
> documentation and examples but haven't been able to come around this. Here 
> is what I have been looking,
>
> https://docs.djangoproject.com/en/dev/topics/testing/overview/#the-test-database
>
> https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/
>
> https://docs.djangoproject.com/en/dev/topics/testing/advanced/#topics-testing-advanced-multidb
>
> http://stackoverflow.com/questions/4650509/different-db-for-testing-in-django
>
> Any suggestions would be appreciated! 
>
> Thanks in advance,
> A
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django: How to combine 3-party apps!

2013-09-08 Thread Germán
Posting the structure without the "garbage" (.pyc, ~) would help.

You have a lot of things mixed up. I suggest you start with a clean project 
and follow the exact installation instructions of Zinnia. Otherwise it's 
quite difficult to detect the errors you have.

On Saturday, September 7, 2013 5:33:47 PM UTC-5, alekto.a...@gmail.com 
wrote:
>
> Would appreciate if anyone had a tip so I can get started :)
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Installing django dev

2013-09-12 Thread Germán Larraín
If you are using a virtualenv I don't see why you need to use "sudo".

Where did you clone the git repo? Do you have the "regular" permissions in that 
directory?

Also, consider reading the dev version of the docs, not 1.5 (like the link you 
referenced).

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Workflow/tools assistance

2013-09-12 Thread Germán Larraín
Some comments:

* why use sqlalchemy if Django has its own ORM?
* you mentioned parsing SQL entries; watch out!
* if you are starting a new project, I seriously recommend you to use 
PostreSQL, not MySQL/Maria DB

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


I cannot enable logging in server console

2013-09-12 Thread Germán Larraín
Perhaps it's a pycharm issue...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: error python manage.py syncdb

2013-09-12 Thread Germán Larraín
Never import Django stuff in your settings (except core.exceptions) unless you 
REALLY know what you are doing

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Reliable and cheap hosting for simple webapp in Django

2013-09-12 Thread Germán Larraín
Also

https://www.nitrous.io

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Access the AdminSite object by its name

2013-10-07 Thread Germán Larraín
Hi.

When using multiple admin sites, it's necessary to give them (except the 
default one) a name to be able to reverse URL names correctly. The default 
admin site's name is 'admin'.
https://docs.djangoproject.com/en/1.5/ref/contrib/admin/#multiple-admin-sites-in-the-same-urlconf

Is it possible to get the admin site object (instance 
of django.contrib.admin.AdminSite) by it's name?

I have some ideas to do this, but all of them are too ugly and convoluted.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/65c14f66-b70f-400d-9be6-f5bd3fc313ac%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.