deprecation warning from HttpResponseRedirect(reverse(...))

2012-08-17 Thread Mike
I seem to be getting a  DeprecationWarning when my view hits this line of 
code:

  return HttpResponseRedirect(reverse(results, args=[query.jobid]))

I'm not directly using any generic views here.  Is this a bug?  If not, 
what is the right way to redirect to a different view?  That line of code 
is still in the tutorial so I assume that it is still the right way to do 
it.  I'm using Django 1.4.
thanks
Mike

-- 
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/-/TwkYoMKmSQwJ.
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: problems in installing django on windows 7

2012-08-17 Thread Amyth Arora
If you still face problem you can go through this tutorial right here
-> http://techstricks.com/install-django-on-windows-7/

On Sat, Aug 18, 2012 at 7:40 AM, Amyth Arora  wrote:
> You can either create a symlink or add the django directory to your
> path for it to work, on windows the django files are installed in
> "C:\Python27\Lib\site-packages\django". You can replace the Python
> directory according to the version of python you are using.
>
> On Fri, Aug 17, 2012 at 11:10 PM, numsontech  wrote:
>> Hi!
>> I am new to the Django frameworks and and having difficulties getting it to
>> work on windows 7. I have successfully installed the latest release but when
>> I try to create a new project using the command "python django-admin.py
>> startproject mysite" it displays the following message: can't open file
>> 'django-admin.py': [err 2] no such file or directory.
>>
>> I wish to know how to resolve this.
>>  I am also trying to symlink the django-admin.py file but I don't know which
>> path to link it to.
>> Any information will be appreciated
>> Thanks!
>>
>> --
>> 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/-/EfBa2-sPjMwJ.
>> 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.
>
>
>
> --
> Thanks & Regards
> 
>
> Amyth [Admin - Techstricks]
> Email - aroras.offic...@gmail.com, ad...@techstricks.com
> Twitter - @a_myth_
> http://techstricks.com/



-- 
Thanks & Regards


Amyth [Admin - Techstricks]
Email - aroras.offic...@gmail.com, ad...@techstricks.com
Twitter - @a_myth_
http://techstricks.com/

-- 
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: problems in installing django on windows 7

2012-08-17 Thread Amyth Arora
You can either create a symlink or add the django directory to your
path for it to work, on windows the django files are installed in
"C:\Python27\Lib\site-packages\django". You can replace the Python
directory according to the version of python you are using.

On Fri, Aug 17, 2012 at 11:10 PM, numsontech  wrote:
> Hi!
> I am new to the Django frameworks and and having difficulties getting it to
> work on windows 7. I have successfully installed the latest release but when
> I try to create a new project using the command "python django-admin.py
> startproject mysite" it displays the following message: can't open file
> 'django-admin.py': [err 2] no such file or directory.
>
> I wish to know how to resolve this.
>  I am also trying to symlink the django-admin.py file but I don't know which
> path to link it to.
> Any information will be appreciated
> Thanks!
>
> --
> 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/-/EfBa2-sPjMwJ.
> 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.



-- 
Thanks & Regards


Amyth [Admin - Techstricks]
Email - aroras.offic...@gmail.com, ad...@techstricks.com
Twitter - @a_myth_
http://techstricks.com/

-- 
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: Full auth solution

2012-08-17 Thread Amyth Arora
You may want to consider a library like Django Allauth by Raymond
Penners, it provides majority of Social Authentication options and a
Custom Registration option as well out of the box.

Repository: https://github.com/pennersr/django-allauth
Tutorial: http://techstricks.com/django-allauth-tutorial-step-by-step/

On Sat, Aug 18, 2012 at 4:16 AM, Tomas Neme  wrote:
>> http://www.django-userena.org/
> ++
>
> I've successfully combined it with django-social-auth to have
> facebook/twitter/google/openId login
>
> --
> "The whole of Japan is pure invention. There is no such country, there
> are no such people" --Oscar Wilde
>
> |_|0|_|
> |_|_|0|
> |0|0|0|
>
> (\__/)
> (='.'=)This is Bunny. Copy and paste bunny
> (")_(") to help him gain world domination.
>
> --
> 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.
>



-- 
Thanks & Regards


Amyth [Admin - Techstricks]
Email - aroras.offic...@gmail.com, ad...@techstricks.com
Twitter - @a_myth_
http://techstricks.com/

-- 
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: Best way to export data from Django?

2012-08-17 Thread Melvyn Sopacua
On 17-8-2012 18:41, Tom wrote:

> I'm able to export the data this way, but I can't get the attributes
> of the full model as I would as if I was using the Django shell.
> Particularly important is the ID of an object, because without that I
> won't know which ID to update on the remote web service. That's why
> I'm only dealing with "created" objects for now.

Why not? You have full access to the created instance with the instance
argument passed to the post_save signal.
You could for example use:
from django.forms import model_to_dict
data = model_to_dict(instance)
print data

and you should see the pk there.

-- 
Melvyn Sopacua

-- 
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: [old question]NoReverseMatch.. I am sorry.

2012-08-17 Thread bruce
Thanks.
I am going to read it. 
Have a great weekend!



On Friday, August 17, 2012 6:30:26 PM UTC-4, Tomas Neme wrote:
>
> > But I am confused. 
> > For example, 
> > the following code needs to add single quote. 
> > 
> > {% block content %} 
> > Add Todo items 
>
> https://docs.djangoproject.com/en/dev/releases/1.3/#changes-to-url-and-ssi 
>
> also, that won't work with double quotes either, unless you import 
> future, and a bunch of other things. 
>
> Just import url from future, since this will be the default behavior 
> in the near future 
>
> -- 
> "The whole of Japan is pure invention. There is no such country, there 
> are no such people" --Oscar Wilde 
>
> |_|0|_| 
> |_|_|0| 
> |0|0|0| 
>
> (\__/) 
> (='.'=)This is Bunny. Copy and paste bunny 
> (")_(") to help him gain world domination. 
>

-- 
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/-/L9UncMhe4BQJ.
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: Full auth solution

2012-08-17 Thread Tomas Neme
> http://www.django-userena.org/
++

I've successfully combined it with django-social-auth to have
facebook/twitter/google/openId login

-- 
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

-- 
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 create a formset that contains forms with a dropdown? (Crucial)

2012-08-17 Thread Kurtis Mullins
+1 on "Roll your own" solution. Complicated M2Ms and Django Forms aren't
always the cleanest pair of features to work with when combined.

On Fri, Aug 17, 2012 at 9:36 AM, houmie  wrote:

> Thanks Melvyn,
>
> To be honest I would be willing to purchase a widget if there was one. iw
> ill look into the list you have sent me.
>
> On another note, Simone mentioned to extend the Formset in order to run my
> own dropdown solution.
>
> I was just looking at the modelformset_factory class and - surpise
> surprise - it accepts a formfield_callback parameter, which could solve my
> dilemma.
>
> I have used callbacks previously within a form to set localized to True:
>
> class CallsForm(ModelForm):
>
> def contact_date_callback(self, field, **kwargs) :
>
> return field.contact_date(localize=**True, **kwargs)
>
>
> But I have no idea how to use it from view
>
> formset_type = modelformset_factory(**SalesItem, form=SalesItemFSForm,
> extra=0, formfield_callback= )
>
>
> Do you happen to know how to use it?
>
> If I was able to set the queryset for the sales_item field in that
> callback, I wouldn't have to extend the factory at all.
>
>
> Many Thanks,
> Houman
>
>
>
>
> On 17/08/12 14:24, Melvyn Sopacua wrote:
>
>> On 17-8-2012 15:00, houmie wrote:
>>
>>  Yes, I know about overriding a widget. I could override a Charfield with
>>> a TextArea.  For simple stuff it makes sense.
>>> Against which widget do I override the existing M2M widget though?
>>>
>> If the one that Tomas linked doesn't work for you, you'll need to
>> consult the roll-your-own department or keep looking around for
>> different widgets, for example:
>> 
>> >
>>
>>
> --
> 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+unsubscribe@**
> 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: Best way to export data from Django?

2012-08-17 Thread Kurtis Mullins
Just curious, which data do you not have available when using signals? You
mentioned the ID but this *should* be available during post_save and
pre_delete hooks, if I'm not mistaken.
Also, I'd recommend caution on performing external server calls during a
single HTTP Request. You might have better luck queuing this up with
something like http://pypi.python.org/pypi/django-celery/

On Fri, Aug 17, 2012 at 12:41 PM, Tom  wrote:

> Hi all,
>
> I'm new to Django, but really enjoying using it so far!
>
> What I'm trying to do is to export data from an admin interface, when a
> record is created or updated. I'm calling another web service to tell it
> the data on site [A] has changed, by using signals.
>
> e.g.
>
> @receiver(post_save, sender=Poll)
> def notify_central_hub(sender, instance, created, **kwargs):
> if created:
>
> #make a string to hold the url of the request
> url = "http://www.example.com/webservice";
>
> #place POST data in a dictionary
> post_data_dictionary = kwargs
>
> #encode the POST data to be sent in a URL
> post_data_encoded = urllib.urlencode(post_data_dictionary)
>
> #make a request object to hold the POST data and the URL
> request_object = urllib2.Request(url, post_data_encoded)
>
> #make the request using the request object as an argument, store
> response in a variable
> response = urllib2.urlopen(request_object)
>
>
> I'm able to export the data this way, but I can't get the attributes of
> the full model as I would as if I was using the Django shell. Particularly
> important is the ID of an object, because without that I won't know which
> ID to update on the remote web service. That's why I'm only dealing with
> "created" objects for now.
>
> Could someone please advise me whether I'm going about this the right way,
> or if there is actually a better way of doing this? I looked into Django
> middleware but this appears to be more for changing the output at the view
> layer, not the data layer. But if there is a better way of doing this, I'd
> be keen to find out!
>
> Many thanks,
>
> 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/-/zystPhngbI0J.
> 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: [old question]NoReverseMatch.. I am sorry.

2012-08-17 Thread Tomas Neme
> But I am confused.
> For example,
> the following code needs to add single quote.
>
> {% block content %}
> Add Todo items

https://docs.djangoproject.com/en/dev/releases/1.3/#changes-to-url-and-ssi

also, that won't work with double quotes either, unless you import
future, and a bunch of other things.

Just import url from future, since this will be the default behavior
in the near future

-- 
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

-- 
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: [old question]NoReverseMatch.. I am sorry.

2012-08-17 Thread Kurtis Mullins
In this case, you are using a 'named URL' in the Admin namespace. Here's
two links that may help you learn a bit more about this topic.

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

On Fri, Aug 17, 2012 at 6:23 PM, bruce  wrote:

> Tears
> thanks!
>
> But I am confused.
> For example,
> the following code needs to add single quote.
>
> {% block content %}
> Add Todo items
>
>
> Is there a link to give me detailed description?
> I want to learn it and never get stuck again.
>
> Thanks!!
>
>
>
>
> On Friday, August 17, 2012 5:37:13 PM UTC-4, Tomas Neme wrote:
>>
>> either remove the quotes from {% url 'blog.views.add_comment' %} (so it's
>> {% url blog.views.add_comment %}) or {% load url from future %}
>>
>> Loading from future is the better option, I think.
>>
>> and for future reference:
>>
>> Reverse for ''blog.views.add_comment'' with arguments '(1L,)' and keyword 
>> arguments '{}' not found.
>>
>> notice how there's two single quotes there, not a double quote? that's
>> your clue, right there
>>
>> --
>> "The whole of Japan is pure invention. There is no such country, there
>> are no such people" --Oscar Wilde
>>
>> |_|0|_|
>> |_|_|0|
>> |0|0|0|
>>
>> (\__/)
>> (='.'=)This is Bunny. Copy and paste bunny
>> (")_(") to help him gain world domination.
>>
>  --
> 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/-/QqYvLl3VNisJ.
>
> 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: [old question]NoReverseMatch.. I am sorry.

2012-08-17 Thread bruce
Tears
thanks!

But I am confused.
For example,
the following code needs to add single quote. 

{% block content %}
Add Todo items


Is there a link to give me detailed description?
I want to learn it and never get stuck again. 

Thanks!!



On Friday, August 17, 2012 5:37:13 PM UTC-4, Tomas Neme wrote:
>
> either remove the quotes from {% url 'blog.views.add_comment' %} (so it's 
> {% url blog.views.add_comment %}) or {% load url from future %}
>
> Loading from future is the better option, I think.
>
> and for future reference:
>
> Reverse for ''blog.views.add_comment'' with arguments '(1L,)' and keyword 
> arguments '{}' not found.
>
> notice how there's two single quotes there, not a double quote? that's 
> your clue, right there
>
> -- 
> "The whole of Japan is pure invention. There is no such country, there are 
> no such people" --Oscar Wilde
>
> |_|0|_|
> |_|_|0|
> |0|0|0|
>
> (\__/) 
> (='.'=)This is Bunny. Copy and paste bunny  
> (")_(") to help him gain world domination.
>

-- 
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/-/QqYvLl3VNisJ.
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: [old question]NoReverseMatch.. I am sorry.

2012-08-17 Thread Tomas Neme
either remove the quotes from {% url 'blog.views.add_comment' %} (so it's
{% url blog.views.add_comment %}) or {% load url from future %}

Loading from future is the better option, I think.

and for future reference:


Reverse for ''blog.views.add_comment'' with arguments '(1L,)' and
keyword arguments '{}' not found.

notice how there's two single quotes there, not a double quote? that's your
clue, right there

-- 
"The whole of Japan is pure invention. There is no such country, there are
no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

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



[old question]NoReverseMatch.. I am sorry.

2012-08-17 Thread bruce
I am sorry I know this is an old topics. 
But I spent the whole day and still unable to fix this problem. 

NoReverseMatch at /1/

Reverse for ''blog.views.add_comment'' with arguments '(1L,)' and keyword 
arguments '{}' not found.

Request Method:GETRequest URL:http://192.168.71.58:8007/1/Django 
Version:1.4Exception 
Type:NoReverseMatchException Value:

Reverse for ''blog.views.add_comment'' with arguments '(1L,)' and keyword 
arguments '{}' not found.






The following is my urls.py


urlpatterns = patterns('',
  
url(r'^admin/', include(admin.site.urls)),
url(r'^(\d+)/$', 'blog.views.post'),
url(r'^add_comment/(\d+)/', 'blog.views.add_comment'),

)




my tempalte:

{% 
csrf_token %}

Name: {{ form.author }}
{{ form.body|linebreaks }}







I tested the add_comment, it seems works.
http://192.168.71.58:8007/add_comment/1/ 
It works. 



any idea? 
Thanks!!!



-- 
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/-/8gp14fMRhO4J.
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 makemessages doesn't recognize trans in templates

2012-08-17 Thread Tomas Neme
> For example for this link
>
> {% trans "contacts" %}
>
> I have the msgstr="Contactos". I expect to see "Contactos" in the browser,
> but I still see "contacts". Any suggestion?

1) case-sensitive. Are you sure you haven't translated "Contacts"
instead of "contacts"?
2) fuzzy-mark. I've noticed that if a translation is marked as
"fuzzy", sometimes gettext doesn't use it

-- 
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

-- 
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 makemessages doesn't recognize trans in templates

2012-08-17 Thread Jojo
Ok guys, I was missing the LOCALE_PATHS in settings.py, now it works 
properly.


Il giorno venerdì 17 agosto 2012 04:15:59 UTC+2, Jojo ha scritto:
>
> Hi, the subject should be a little clear so, this is the project folder 
> structure
>
> project folder
>  locale
>   en
> LC_MESSAGES
>   django.po
>   es
> LC_MESSAGES
>   django.po
>   it
> LC_MESSAGES
>   django.po
>   project
> __init__.py
> mochileros
> settings.py
> urls.py
> wsgi.py
>   application folder
> models.py
> views.py
>
>
> I have created a locale folder and after I launched the django-admin.py 
> makemessages command as explained in the documentation, but when I open a 
> .po file (the command create the files actually), I can't found 
> the msgid/msgstr relative to the translation instruction in my template 
> files.
> This is my base template.
>
> {% load i18n %} 
>
> 
> 
> ...
> 
> {% trans "home" %}
> {% trans "contacts" %}
> {% trans "about_us" %}
> ...
> 
>
>
> I have added the LocaleMiddleware in the settings file so, do I forgot 
> something?
> Any suggestions?
>
>
> Thank you in advance
>

-- 
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/-/U0ZiGabiSUgJ.
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 1.4: Error importing email backend module django.core.mail.backends.smtp: "cannot import name sanitize_address"

2012-08-17 Thread Jan Vilhuber
Please ignore this message. Seems to be a local issue with my instlal 
somehow.
jan


On Friday, August 17, 2012 2:41:49 PM UTC-6, Jan Vilhuber wrote:
>
> I see the import in core.mail.backends.smtp, but I don't see 
> sanity_address in core.mail.message, which is where it's trying to import 
> from:
>
> from django.core.mail.message import sanitize_address
>
> Please advise.
> jan
>
>

-- 
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/-/LxRNCTQFwSUJ.
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 makemessages doesn't recognize trans in templates

2012-08-17 Thread Jojo
I got it.
My templates files have htm extension and makemessages looks for htmL 
files, so I used -e option specifying htm extension like this:

django-admin.py makemessages -l es -e htm

Now I have msgid/msgstr that I need.

NOW

I compiled the msgstr with the translations an compiled the messages with 
the command compilemessages, but I can't see the translations in my page.

For example for this link

{% trans "contacts" %}

I have the msgstr="Contactos". I expect to see "Contactos" in the browser, 
but I still see "contacts". Any suggestion?

Thank you



Il giorno venerdì 17 agosto 2012 04:15:59 UTC+2, Jojo ha scritto:
>
> Hi, the subject should be a little clear so, this is the project folder 
> structure
>
> project folder
>  locale
>   en
> LC_MESSAGES
>   django.po
>   es
> LC_MESSAGES
>   django.po
>   it
> LC_MESSAGES
>   django.po
>   project
> __init__.py
> mochileros
> settings.py
> urls.py
> wsgi.py
>   application folder
> models.py
> views.py
>
>
> I have created a locale folder and after I launched the django-admin.py 
> makemessages command as explained in the documentation, but when I open a 
> .po file (the command create the files actually), I can't found 
> the msgid/msgstr relative to the translation instruction in my template 
> files.
> This is my base template.
>
> {% load i18n %} 
>
> 
> 
> ...
> 
> {% trans "home" %}
> {% trans "contacts" %}
> {% trans "about_us" %}
> ...
> 
>
>
> I have added the LocaleMiddleware in the settings file so, do I forgot 
> something?
> Any suggestions?
>
>
> Thank you in advance
>

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



django 1.4: Error importing email backend module django.core.mail.backends.smtp: "cannot import name sanitize_address"

2012-08-17 Thread Jan Vilhuber
I see the import in core.mail.backends.smtp, but I don't see sanity_address in 
core.mail.message, which is where it's trying to import from:

from django.core.mail.message import sanitize_address

Please advise.
jan

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



Django-SEO issue

2012-08-17 Thread jondbaker
I've successfully installed Django-SEO, but when I try to limit the number 
of backends (I only need/want my admin to have 'path' and not the other 
three) I am met with the following error:
AttributeError at /admin/'NoneType' object has no attribute '_meta'

I am using the documentation here: 
http://django-seo.readthedocs.org/en/latest/reference/definition.html#Meta.backends

*seo.py*
from rollyourown import seo

class AppMetadata(seo.Metadata):
title = seo.Tag(head=True, max_length=68)
description = seo.MetaTag(max_length=155)

class Meta:
backends = ('path',)
#backends = ('path', 'modelinstance', 'model', 'view',) This works 
but includes all default backends

*admin.py*
from django.contrib import admin
from rollyourown.seo.admin import register_seo_admin

from localsite.seo import AppMetadata

register_seo_admin(admin.site, AppMetadata)

-- 
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/-/B1W0iR7aNokJ.
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 makemessages doesn't recognize trans in templates

2012-08-17 Thread Jojo
i'm sorry, templates are in application folder in the templates directory

Il giorno venerdì 17 agosto 2012 04:15:59 UTC+2, Jojo ha scritto:
>
> Hi, the subject should be a little clear so, this is the project folder 
> structure
>
> project folder
>  locale
>   en
> LC_MESSAGES
>   django.po
>   es
> LC_MESSAGES
>   django.po
>   it
> LC_MESSAGES
>   django.po
>   project
> __init__.py
> mochileros
> settings.py
> urls.py
> wsgi.py
>   application folder
> models.py
> views.py
>
>
> I have created a locale folder and after I launched the django-admin.py 
> makemessages command as explained in the documentation, but when I open a 
> .po file (the command create the files actually), I can't found 
> the msgid/msgstr relative to the translation instruction in my template 
> files.
> This is my base template.
>
> {% load i18n %} 
>
> 
> 
> ...
> 
> {% trans "home" %}
> {% trans "contacts" %}
> {% trans "about_us" %}
> ...
> 
>
>
> I have added the LocaleMiddleware in the settings file so, do I forgot 
> something?
> Any suggestions?
>
>
> Thank you in advance
>

-- 
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/-/xhDSS_-kN6AJ.
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: Full auth solution

2012-08-17 Thread Kurtis Mullins
http://www.django-userena.org/

-- 
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 + FAPWS doesnt show the templates/view correct

2012-08-17 Thread keeran
Yes, looks like something went wrong due to static file access; I find 
http/1.1 404 not found error under web console of firefox
Status Code:
HTTP/1.1 404 NOT FOUND
 
I tried option from link 
https://docs.djangoproject.com/en/1.4/ref/contrib/staticfiles/#static-file-development-view
 
still not yet resolved.

On Friday, August 17, 2012 4:27:03 PM UTC+5:30, Paul Backhouse wrote:

> Are you sure it's a views/templates issue? You're getting content that 
> looks correct in structure so I'd say the views + templates are fine. 
> Looks like a CSS issue to me. 
>
> If you're using firefox then install firebug and check the NET tab for 
> 404s to your CSS files. 
>
> Paul 
>
> On Fri, 2012-08-17 at 02:43 -0700, keeran wrote: 
> > On the Django development server, django app works fine. But once I 
> > setup the production test run, I get only the text contents, where 
> > template views are not shown as intended. What am I going wrong? 
> > 
> > I have django 1.5 latest. 
> > 
> >  Nginx - 0.8.54 
> > 
> > uWSGI - 1.2.5 
>
>
>
>
>

-- 
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/-/p7H2tlXtzGAJ.
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: Problem with the urls.py "unexpected end of pattern"

2012-08-17 Thread Alexis Roda

I think that this is not the problem because I can access to volunters
without problems. I have problems only with admin, organizers and events
paths.


So you have problems with all the urls past the first with a wrong pattern.

~$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.compile(r'^volunters/(?V\d+)/$')
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.6/re.py", line 190, in compile
return _compile(pattern, flags)
  File "/usr/lib/python2.6/re.py", line 245, in _compile
raise error, v # invalid expression
sre_constants.error: unexpected end of pattern
>>> re.compile(r'^volunters/(?P\d+)/$')
<_sre.SRE_Pattern object at 0xb76ec590>


Regards

--
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: Full auth solution

2012-08-17 Thread Alec Taylor
Pinax?

On Sat, Aug 18, 2012 at 2:53 AM, pearlball
 wrote:
> Although the auth module is very useful, there's still a lot of faffing to be 
> done just to get a standard user login system in place. Can anyone recommend 
> a sort of boilerplate solution with a full suite of registration, user 
> profile pages, etc. written up and ready to copy/paste or plug/play?
>
> Thanks
>
> --
> 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/-/muxbVUxSTJoJ.
> 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.



problems in installing django on windows 7

2012-08-17 Thread numsontech
Hi!
I am new to the Django frameworks and and having difficulties getting it to 
work on windows 7. I have successfully installed the latest release but 
when I try to create a new project using the command "python 
django-admin.py startproject mysite" it displays the following message: 
can't open file 'django-admin.py': [err 2] no such file or directory.

I wish to know how to resolve this.
 I am also trying to symlink the django-admin.py file but I don't know 
which path to link it to. 
Any information will be appreciated
Thanks!

-- 
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/-/EfBa2-sPjMwJ.
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.



Full auth solution

2012-08-17 Thread pearlball
Although the auth module is very useful, there's still a lot of faffing to be 
done just to get a standard user login system in place. Can anyone recommend a 
sort of boilerplate solution with a full suite of registration, user profile 
pages, etc. written up and ready to copy/paste or plug/play?

Thanks

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



Best way to export data from Django?

2012-08-17 Thread Tom
Hi all,

I'm new to Django, but really enjoying using it so far!

What I'm trying to do is to export data from an admin interface, when a record 
is created or updated. I'm calling another web service to tell it the data on 
site [A] has changed, by using signals.

e.g.

@receiver(post_save, sender=Poll)
def notify_central_hub(sender, instance, created, **kwargs):
if created: 

#make a string to hold the url of the request
url = "http://www.example.com/webservice";

#place POST data in a dictionary
post_data_dictionary = kwargs

#encode the POST data to be sent in a URL
post_data_encoded = urllib.urlencode(post_data_dictionary)

#make a request object to hold the POST data and the URL
request_object = urllib2.Request(url, post_data_encoded)

#make the request using the request object as an argument, store 
response in a variable
response = urllib2.urlopen(request_object)


I'm able to export the data this way, but I can't get the attributes of the 
full model as I would as if I was using the Django shell. Particularly 
important is the ID of an object, because without that I won't know which ID to 
update on the remote web service. That's why I'm only dealing with "created" 
objects for now.

Could someone please advise me whether I'm going about this the right way, or 
if there is actually a better way of doing this? I looked into Django 
middleware but this appears to be more for changing the output at the view 
layer, not the data layer. But if there is a better way of doing this, I'd be 
keen to find out!

Many thanks,

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/-/zystPhngbI0J.
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: Problem with the urls.py "unexpected end of pattern"

2012-08-17 Thread Rafael Romero Carmona
2012/8/17 Alexis Roda 

> Al 17/08/12 17:42, En/na Rafael Romero Carmona ha escrit:
>
>  Hi, I'm learning Django and I have problems with the urls.py. I show you
>> how that's writed:
>>
>> from django.conf.urls import patterns, include, url
>>
>> from django.contrib import admin
>> admin.autodiscover()
>>
>> urlpatterns = patterns('users.views',
>>
>>  url(r'^volunters/$', 'voluntersindex'),
>>  url(r'^volunters/(?V\d+)/$', 'volunterdetails'),
>>  url(r'^organizers/$', 'organizersindex'),
>>  url(r'^organizers/(?O<**organizer_id>\d+)/$', 'organizerdetails'),
>>  url(r'^events/$', 'eventsindex'),
>>  url(r'^events/(?E\d+**)/$', 'eventdetails'),
>>
>> )
>>
>> urlpatterns += patterns('',
>>  url(r'^admin/', include(admin.site.urls)),
>> )
>>
>> When I try to show admin/, organizers/ and events/ I receive a menssage
>> like:"unexpected end of pattern; Exception Location:
>> /usr/lib/python2.6/re.py in _compile, line 245"
>>
>> How can I fix it? Thanks and sorry if I have errors in my sentences.
>>
>
> The regular expressions are wrong, Try with (?P\d+) etc.
>
>
>
I think that this is not the problem because I can access to volunters
without problems. I have problems only with admin, organizers and events
paths. I think that the problem isn't in other files because the problem is
about regular expresions in the urls.py file, but if you want I could show
you other files like views.py or others.

-- 
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: Not reading from TEMPLATE_DIRS in settings.py

2012-08-17 Thread Amyth Arora
Glad that you solved it! However, i would recommend using absolute
path instead of a relative path as it might break when you clone or
move it to another location.



On Fri, Aug 17, 2012 at 6:17 PM, madala  wrote:
> Thanks I solved it. Was looking up wrong directory because I followed the
> instructions to put the absolute path. If I put the relative path it works
> fine. Thanks for taking time to answer anyway. People are so kind! :0)
>
> On Tuesday, 14 August 2012 14:54:45 UTC+1, ephan wrote:
>>
>> Have you checked the permissions of the directory and template
>> files?
>> run ls -l in the parent directory of the template folder and inside
>> the folder itself .
>> madala wrote:
>> > Have followed tutorial 2 instructions carefully. So far everything has
>> > worked as described in tutorials but cannot get django to load files
>> > from
>> > my own template directory. Seems a very simple problem.
>> >
>> > here's the part of my settings.py:
>> >
>> > TEMPLATE_DIRS = (
>> > '/home/madala/WebsiteCode/templates',
>> > "/home/madala/Website/templates",
>> > # Put strings here, like "/home/html/django_templates" or
>> > "C:/www/django/templates".
>> > # Always use forward slashes, even on Windows.
>> > # Don't forget to use absolute paths, not relative paths.
>> > )
>> >
>> > So I carried on and started tutorial 3 till I got halfway down and had
>> > to
>> > do same thing but no matter what I try can't get Django to recognize my
>> > directories.
>> >
>> > Can anyone see where I am going wrong please? thanks in anticipation.
>
> --
> 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/-/-WksJy4qUkoJ.
>
> 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.



-- 
Thanks & Regards


Amyth [Admin - Techstricks]
Email - aroras.offic...@gmail.com, ad...@techstricks.com
Twitter - @a_myth_
http://techstricks.com/

-- 
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: Problem with the urls.py "unexpected end of pattern"

2012-08-17 Thread Alexis Roda

Al 17/08/12 17:42, En/na Rafael Romero Carmona ha escrit:

Hi, I'm learning Django and I have problems with the urls.py. I show you
how that's writed:

from django.conf.urls import patterns, include, url

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('users.views',

 url(r'^volunters/$', 'voluntersindex'),
 url(r'^volunters/(?V\d+)/$', 'volunterdetails'),
 url(r'^organizers/$', 'organizersindex'),
 url(r'^organizers/(?O\d+)/$', 'organizerdetails'),
 url(r'^events/$', 'eventsindex'),
 url(r'^events/(?E\d+)/$', 'eventdetails'),

)

urlpatterns += patterns('',
 url(r'^admin/', include(admin.site.urls)),
)

When I try to show admin/, organizers/ and events/ I receive a menssage
like:"unexpected end of pattern; Exception Location:
/usr/lib/python2.6/re.py in _compile, line 245"

How can I fix it? Thanks and sorry if I have errors in my sentences.


The regular expressions are wrong, Try with (?P\d+) etc.



HTH

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



Problem with the urls.py "unexpected end of pattern"

2012-08-17 Thread Rafael Romero Carmona
Hi, I'm learning Django and I have problems with the urls.py. I show you
how that's writed:

from django.conf.urls import patterns, include, url

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('users.views',

url(r'^volunters/$', 'voluntersindex'),
url(r'^volunters/(?V\d+)/$', 'volunterdetails'),
url(r'^organizers/$', 'organizersindex'),
url(r'^organizers/(?O\d+)/$', 'organizerdetails'),
url(r'^events/$', 'eventsindex'),
url(r'^events/(?E\d+)/$', 'eventdetails'),

)

urlpatterns += patterns('',
url(r'^admin/', include(admin.site.urls)),
)

When I try to show admin/, organizers/ and events/ I receive a menssage
like:"unexpected end of pattern; Exception Location:
/usr/lib/python2.6/re.py in _compile, line 245"

How can I fix it? Thanks and sorry if I have errors in my sentences.

-- 
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 makemessages doesn't recognize trans in templates

2012-08-17 Thread Melvyn Sopacua
On 17-8-2012 4:15, Jojo wrote:

> I have created a locale folder and after I launched the django-admin.py 
> makemessages command as explained in the documentation, but when I open a 
> .po file (the command create the files actually), I can't found 
> the msgid/msgstr relative to the translation instruction in my template 
> files.

This is one of the limitations of the makemessages command.
I've ironed out a number of them in a 'projectmessages' management command:
http://dpaste.de/QEA9D/

It's a work in progress, but fits my needs for now. YMMV.

-- 
Melvyn Sopacua

-- 
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 create a formset that contains forms with a dropdown? (Crucial)

2012-08-17 Thread houmie

Thanks Melvyn,

To be honest I would be willing to purchase a widget if there was one. 
iw ill look into the list you have sent me.


On another note, Simone mentioned to extend the Formset in order to run 
my own dropdown solution.


I was just looking at the modelformset_factory class and - surpise 
surprise - it accepts a formfield_callback parameter, which could solve 
my dilemma.


I have used callbacks previously within a form to set localized to True:

class CallsForm(ModelForm):

def contact_date_callback(self, field, **kwargs) :

return field.contact_date(localize=True, **kwargs)


But I have no idea how to use it from view

formset_type = modelformset_factory(SalesItem, form=SalesItemFSForm, extra=0, 
formfield_callback= )


Do you happen to know how to use it?

If I was able to set the queryset for the sales_item field in that 
callback, I wouldn't have to extend the factory at all.



Many Thanks,
Houman



On 17/08/12 14:24, Melvyn Sopacua wrote:

On 17-8-2012 15:00, houmie wrote:


Yes, I know about overriding a widget. I could override a Charfield with
a TextArea.  For simple stuff it makes sense.
Against which widget do I override the existing M2M widget though?

If the one that Tomas linked doesn't work for you, you'll need to
consult the roll-your-own department or keep looking around for
different widgets, for example:




--
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 create a formset that contains forms with a dropdown? (Crucial)

2012-08-17 Thread Melvyn Sopacua
On 17-8-2012 15:00, houmie wrote:

> Yes, I know about overriding a widget. I could override a Charfield with
> a TextArea.  For simple stuff it makes sense.
> Against which widget do I override the existing M2M widget though?

If the one that Tomas linked doesn't work for you, you'll need to
consult the roll-your-own department or keep looking around for
different widgets, for example:


-- 
Melvyn Sopacua

-- 
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 create a formset that contains forms with a dropdown? (Crucial)

2012-08-17 Thread houmie

Thanks Melvyn,

Yes, I know about overriding a widget. I could override a Charfield with 
a TextArea.  For simple stuff it makes sense.

Against which widget do I override the existing M2M widget though?


On 17/08/12 01:01, Melvyn Sopacua wrote:

On 17-8-2012 1:05, Houman wrote:


What I am trying to achieve would be deal type having a m2m
relationship to sales items. I don't like the m2m widget,

So change it. All ModelForm derivatives have a widgets argument that is
a dictionary of fieldname => widget 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: Not reading from TEMPLATE_DIRS in settings.py

2012-08-17 Thread madala
Thanks I solved it. Was looking up wrong directory because I followed the 
instructions to put the absolute path. If I put the relative path it works 
fine. Thanks for taking time to answer anyway. People are so kind! :0)

On Tuesday, 14 August 2012 14:54:45 UTC+1, ephan wrote:
>
> Have you checked the permissions of the directory and template 
> files? 
> run ls -l in the parent directory of the template folder and inside 
> the folder itself . 
> madala wrote: 
> > Have followed tutorial 2 instructions carefully. So far everything has 
> > worked as described in tutorials but cannot get django to load files 
> from 
> > my own template directory. Seems a very simple problem. 
> > 
> > here's the part of my settings.py: 
> > 
> > TEMPLATE_DIRS = ( 
> > '/home/madala/WebsiteCode/templates', 
> > "/home/madala/Website/templates", 
> > # Put strings here, like "/home/html/django_templates" or 
> > "C:/www/django/templates". 
> > # Always use forward slashes, even on Windows. 
> > # Don't forget to use absolute paths, not relative paths. 
> > ) 
> > 
> > So I carried on and started tutorial 3 till I got halfway down and had 
> to 
> > do same thing but no matter what I try can't get Django to recognize my 
> > directories. 
> > 
> > Can anyone see where I am going wrong please? thanks in anticipation. 
>

-- 
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/-/-WksJy4qUkoJ.
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: Not reading from TEMPLATE_DIRS in settings.py

2012-08-17 Thread madala
Thanks I solved it. Was looking up wrong directory because I followed the 
instructions to put the absolute path. If I put the relative path it works 
fine. Thanks for taking time to answer anyway. People are so kind! :0)

On Tuesday, 14 August 2012 14:59:11 UTC+1, Alexis Roda wrote:
>
> Al 14/08/12 12:50, En/na madala ha escrit: 
> > 
> > So I carried on and started tutorial 3 till I got halfway down and had 
> > to do same thing but no matter what I try can't get Django to recognize 
> > my directories. 
> > 
> > Can anyone see where I am going wrong please? thanks in anticipation. 
>
> What error are you getting? template not found? please pastebin the 
> traceback. 
>
>
>
> Regards 
>

-- 
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/-/bY9da6YjOZYJ.
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: Not reading from TEMPLATE_DIRS in settings.py

2012-08-17 Thread madala
Thanks I solved it. Was looking up wrong directory because I followed the 
instructions to put the absolute path. If I put the relative path it works 
fine. Thanks for taking time to answer anyway. People are so kind! :0)

On Friday, 17 August 2012 10:21:22 UTC+1, Amyth wrote:
>
> While you get this error do you see your template dir listed on the 
> error/debug page ? 
>
> On Fri, Aug 17, 2012 at 2:46 PM, madala > 
> wrote: 
> > Thanks you for replying. Here is traceback: 
> > 
> > Traceback (most recent call last): 
> >   File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run 
> > self.result = application(self.environ, self.start_response) 
> >   File 
> > "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", 
> line 
> > 241, in __call__ 
> > response = self.get_response(request) 
> >   File 
> > "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", 
> line 
> > 153, in get_response 
> > response = self.handle_uncaught_exception(request, resolver, 
> > sys.exc_info()) 
> >   File 
> > "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", 
> line 
> > 228, in handle_uncaught_exception 
> > return callback(request, **param_dict) 
> >   File 
> "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py", 
> > line 91, in _wrapped_view 
> > response = view_func(request, *args, **kwargs) 
> >   File 
> "/usr/local/lib/python2.7/dist-packages/django/views/defaults.py", 
> > line 32, in server_error 
> > t = loader.get_template(template_name) # You need to create a 
> 500.html 
> > template. 
> >   File 
> "/usr/local/lib/python2.7/dist-packages/django/template/loader.py", 
> > line 145, in get_template 
> > template, origin = find_template(template_name) 
> >   File 
> "/usr/local/lib/python2.7/dist-packages/django/template/loader.py", 
> > line 138, in find_template 
> > raise TemplateDoesNotExist(name) 
> > TemplateDoesNotExist: 500.html 
> > [17/Aug/2012 10:11:59] "GET / HTTP/1.1" 500 59 
> > 
> > 
> > On Tuesday, 14 August 2012 14:59:11 UTC+1, Alexis Roda wrote: 
> >> 
> >> Al 14/08/12 12:50, En/na madala ha escrit: 
> >> > 
> >> > So I carried on and started tutorial 3 till I got halfway down and 
> had 
> >> > to do same thing but no matter what I try can't get Django to 
> recognize 
> >> > my directories. 
> >> > 
> >> > Can anyone see where I am going wrong please? thanks in anticipation. 
> >> 
> >> What error are you getting? template not found? please pastebin the 
> >> traceback. 
> >> 
> >> 
> >> 
> >> Regards 
> > 
> > -- 
> > 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/-/fif5nO4VPsYJ. 
> > 
> > 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. 
>
>
>
> -- 
> Thanks & Regards 
>  
>
> Amyth [Admin - Techstricks] 
> Email - aroras@gmail.com , 
> ad...@techstricks.com 
> Twitter - @a_myth_ 
> http://techstricks.com/ 
>

-- 
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/-/LCl8ekIFfLkJ.
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 sessions in Django

2012-08-17 Thread Sandeep kaur
On Fri, Aug 17, 2012 at 1:28 PM, Sandeep kaur  wrote:
> I am using session foreign key in my table.

>  if not request.session.exists(request.session.session_key):
> request.session.create()
>  profile.sess = request.session.session_key
>  profile.save()
>
> But when I execute my form and click on submit button, I get error as :
>
> ```Cannot assign "'b593c61453d7aad199078c66b9ad6b30'":
> "ClientJob.sess" must be a "Session" instance.
>

Problem solved!!
Used this code :

if not request.session.exists(request.session.session_key):
request.session.create()
profile.sess = Session.objects.get(session_key=request.session.session_key)

-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.com

-- 
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: Adding Button in admin form

2012-08-17 Thread Alexis Roda

Al 17/08/12 13:05, En/na Madhu ha escrit:

Yes, That's right. I tried to change the admin form, but the button is
not added.
the fuctionality Jani Tiainen said i want the same fuctionality, but the
now first problem is adding button in change form.


As Jani has pointed I think that a custom widget (text field + button) 
plus a custom form that associates that widget to the 'url' field could 
do the trick.



HTH

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



Any Django people in Windor/West London looking for a client?

2012-08-17 Thread Andy Baker
We built a fairly simple Django site and the client would like someone more 
local to take over maintenance. If anyone is interested then drop me a 
line. I'm happy to help with the handover.

-- 
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/-/BBRBr4uwPcUJ.
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: Adding Button in admin form

2012-08-17 Thread Madhu
Yes, That's right. I tried to change the admin form, but the button is not 
added.
the fuctionality Jani Tiainen said i want the same fuctionality, but the 
now first problem is adding button in change form.

-- 
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/-/P3fIv6ngxmsJ.
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 + FAPWS doesnt show the templates/view correct

2012-08-17 Thread Paul Backhouse
Are you sure it's a views/templates issue? You're getting content that
looks correct in structure so I'd say the views + templates are fine.
Looks like a CSS issue to me.

If you're using firefox then install firebug and check the NET tab for
404s to your CSS files.

Paul

On Fri, 2012-08-17 at 02:43 -0700, keeran wrote:
> On the Django development server, django app works fine. But once I
> setup the production test run, I get only the text contents, where
> template views are not shown as intended. What am I going wrong? 
> 
> I have django 1.5 latest.
> 
>  Nginx - 0.8.54 
> 
> uWSGI - 1.2.5




-- 
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 create a formset that contains forms with a dropdown? (Crucial)

2012-08-17 Thread houmie

Thanks Thomas.

Just trying to apply the DropDownMultiple Widget that you have 
suggested. I have followed the instruction:


|class MyForm(forms.ModelForm):
categories = forms.Field(widget=DropDownMultiple)

def __init__(self, *args, **kwargs):
self.base_fields['categories'].widget.choices = 
Category.objects.values_list('id', 'name')
super(MyForm, self).__init__(*args, **kwargs)|


And I get an exception at python level.  This code seems to have been 
written in 2008. I wonder if its still working with the latest python 
and django. :(


As soon as I add the line

|categories = forms.Field(widget=DropDownMultiple)|

to my form i get this exception:

Traceback:

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in 
get_response

  111. response = callback(request, *callback_args, 
**callback_kwargs)

File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/decorators.py" 
in _wrapped_view

  20. return view_func(request, *args, **kwargs)

File "/home/houman/projects/my/my_app/views.py" in deal_template_view

  303. form = DealTypeForm(instance=deal)

File "/home/houman/projects/my/my_app/forms.py" in __init__

  252. super(DealTypeForm, self).__init__(*args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/django/forms/models.py" in __init__

  247. error_class, label_suffix, 
empty_permitted)

File "/usr/local/lib/python2.7/dist-packages/django/forms/forms.py" in __init__

  95. self.fields = copy.deepcopy(self.base_fields)

File "/usr/lib/python2.7/copy.py" in deepcopy

  174. y = copier(memo)

File "/usr/local/lib/python2.7/dist-packages/django/utils/datastructures.py" in 
__deepcopy__

  129.for key, value in self.iteritems()])

File "/usr/lib/python2.7/copy.py" in deepcopy

  174. y = copier(memo)

File "/usr/local/lib/python2.7/dist-packages/django/forms/fields.py" in 
__deepcopy__

  180. result.widget = copy.deepcopy(self.widget, memo)

File "/usr/lib/python2.7/copy.py" in deepcopy

  190. y = _reconstruct(x, rv, 1, memo)

File "/usr/lib/python2.7/copy.py" in _reconstruct

  334. state = deepcopy(state, memo)

File "/usr/lib/python2.7/copy.py" in deepcopy

  163. y = copier(x, memo)

File "/usr/lib/python2.7/copy.py" in _deepcopy_dict

  257. y[deepcopy(key, memo)] = deepcopy(value, memo)

File "/usr/lib/python2.7/copy.py" in deepcopy

  163. y = copier(x, memo)

File "/usr/lib/python2.7/copy.py" in _deepcopy_dict

  257. y[deepcopy(key, memo)] = deepcopy(value, memo)

File "/usr/lib/python2.7/copy.py" in deepcopy

  190. y = _reconstruct(x, rv, 1, memo)

File "/usr/lib/python2.7/copy.py" in _reconstruct

  329. y = callable(*args)

File "/usr/lib/python2.7/copy_reg.py" in __newobj__

  93. return cls.__new__(cls, *args)

Exception Type: TypeError at /deal/add/

Exception Value: object.__new__(NotImplementedType) is not safe, use 
NotImplementedType.__new__()


On 17/08/12 02:22, Tomas Neme wrote:

DropDownMultiple widget

http://djangosnippets.org/snippets/747/



--
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: Adding Button in admin form

2012-08-17 Thread Jani Tiainen

17.8.2012 13:42, Madhu kirjoitti:

No. URL linking is not the problem. I have the problem to add the input
button in admin form.

There will be so many buttons in admin form like save, add, delete. I
want to add my own button, but in the middle of admin form not at the
submit line or upper part of the admin form. That button should be
display near to my character field.

Using html we create  then button tag will be display
in the html page.
I want the same input button on the admin form.



If I understood correctly OP want's to display button after URL field 
that says something like "select existing". When user clicks it it 
fetches (ajax query maybe) list of URLs from database and user can 
select value that is then copied to text field instead of typing URL 
manually to text field.


How to achieve that kind of functionality in admin beats me. Probably it 
would be possible with custom field though I think it might work better 
out with totally custom form that looks like admin page where it's very 
easy to add more control than standard admin does.


--
Jani Tiainen

- Well planned is half done and a half done has been sufficient before...

--
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: Adding Button in admin form

2012-08-17 Thread Thomas Orozco
I'm sorry, I really have a hard time understanding what you need, but you
might want to try overriding the form template to add your button?

If so, try the change_form_template parameter.
Le 17 août 2012 12:42, "Madhu"  a écrit :

> No. URL linking is not the problem. I have the problem to add the input
> button in admin form.
>
> There will be so many buttons in admin form like save, add, delete. I want
> to add my own button, but in the middle of admin form not at the submit
> line or upper part of the admin form. That button should be display near to
> my character field.
>
> Using html we create  then button tag will be display
> in the html page.
> I want the same input button on the admin form.
>
> --
> 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/-/LVBJArH-RH8J.
> 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: Adding Button in admin form

2012-08-17 Thread Madhu
No. URL linking is not the problem. I have the problem to add the input 
button in admin form.

There will be so many buttons in admin form like save, add, delete. I want 
to add my own button, but in the middle of admin form not at the submit 
line or upper part of the admin form. That button should be display near to 
my character field.

Using html we create  then button tag will be display in 
the html page.
I want the same input button on the admin form.

-- 
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/-/LVBJArH-RH8J.
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.



How to integrate a project as an app into another project?

2012-08-17 Thread santiF
Hi all,

I am just wondering, how can I turn my whole project into a pluggable 
application so that others can just add my application to their project.

Thanks for your time!

-- 
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/-/Av_-3Y2DxlIJ.
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.



Django + FAPWS doesnt show the templates/view correct

2012-08-17 Thread keeran


On the Django development server, django app works fine. But once I setup 
the production test run, I get only the text contents, where template views 
are not shown as intended. What am I going wrong? 

I have django 1.5 latest.

 Nginx - 0.8.54 

uWSGI - 1.2.5
Also tried FAPWS3.0 similar result;
 
cmd for uWSGI:
=
sudo uwsgi --ini test.ini
 
 

test.ini content:
===
[uwsgi]
# set the http port
http = :8080
python_path = /home/test/Desktop/IT_mgmt/IT_mgmt/settings.py/
# change to django project directory
chdir = /home/test/Desktop/IT_mgmt
# load django
module = IT_mgmt.wsgi


 

-- 
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/-/jREnh7i2o70J.
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 Form for ManyToMany, missing Green Plus Sign?

2012-08-17 Thread andrea
Registering the model worked for me. Thanks!

On Tuesday, February 16, 2010 11:18:09 PM UTC+11, Matt Schinckel wrote:
>
> On Feb 14, 3:49 pm, john  wrote:
> >
> > Yes, the Items model data can be accessed through another part of the
> > Admin interface, but I think the purpose of the Green Plus Sign was to
> > alleviate this extra step.
>
> Try registering the model of that type with the admin. The green plus
> will only appear if the model is registered - otherwise it is unable
> to find a change_form to allow for adding/editing the initial values.
>
>

-- 
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/-/7H5D7Z-k6uUJ.
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: Adding Button in admin form

2012-08-17 Thread Thomas Orozco
So you would want to have a link to the url that was entered?
Le 17 août 2012 12:15, "Madhu"  a écrit :

> Ok. I will explain it in brief.
>
> I want the button like the image field having the Browse button with the
> Image field in admin side i want the same button but the functionality may
> be different. Don't want that the browser button functionality but i want
> the button along with the my URL character field.
> That button should be be display and we i click on that button then some
> functionality.
>
> Right now i didn't understand, how to add that button in admin form.
> Can you please suggest?
>
> --
> 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/-/Ov0QyqEbsCQJ.
> 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: Adding Button in admin form

2012-08-17 Thread Madhu
Ok. I will explain it in brief.

I want the button like the image field having the Browse button with the 
Image field in admin side i want the same button but the functionality may 
be different. Don't want that the browser button functionality but i want 
the button along with the my URL character field.
That button should be be display and we i click on that button then some 
functionality.

Right now i didn't understand, how to add that button in admin form.
Can you please suggest?

-- 
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/-/Ov0QyqEbsCQJ.
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: Adding Button in admin form

2012-08-17 Thread Thomas Orozco
Then there must be something I don't understand in what you need, could you
describe a bit more?
Le 17 août 2012 12:02, "Madhu"  a écrit :

>
> I try the row_id_fields, but its not helpful for me.
> I want the button will be display in admin form.
> Using row_id_fields its just the linking of foreign key i don't want that.
> The button functionality will be later before that i want the button tag
> will be display on admin form.
>
>  --
> 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/-/7CrtkDOzAycJ.
> 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: Adding Button in admin form

2012-08-17 Thread Madhu

I try the row_id_fields, but its not helpful for me.
I want the button will be display in admin form.
Using row_id_fields its just the linking of foreign key i don't want that.
The button functionality will be later before that i want the button tag 
will be display on admin form.

-- 
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/-/7CrtkDOzAycJ.
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: Adding Button in admin form

2012-08-17 Thread Thomas Orozco
(again) did you try using raw_id_fields?
Le 17 août 2012 11:26, "Madhu"  a écrit :

> Can you please tell me how to add the Buttom on admin form in django?
> I want to add the button beside the field.
>
> --
> 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/-/WACTMw1ykxMJ.
> 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: Adding Button in admin form

2012-08-17 Thread Amyth Arora
Django Admin by default only provides Dropdown option for Foreign Keys.

On Fri, Aug 17, 2012 at 2:56 PM, Madhu  wrote:
> Can you please tell me how to add the Buttom on admin form in django?
> I want to add the button beside the field.
>
> --
> 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/-/WACTMw1ykxMJ.
>
> 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.



-- 
Thanks & Regards


Amyth [Admin - Techstricks]
Email - aroras.offic...@gmail.com, ad...@techstricks.com
Twitter - @a_myth_
http://techstricks.com/

-- 
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: Adding Button in admin form

2012-08-17 Thread Madhu
Can you please tell me how to add the Buttom on admin form in django?
I want to add the button beside the field.

-- 
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/-/WACTMw1ykxMJ.
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: Not reading from TEMPLATE_DIRS in settings.py

2012-08-17 Thread Amyth Arora
While you get this error do you see your template dir listed on the
error/debug page ?

On Fri, Aug 17, 2012 at 2:46 PM, madala  wrote:
> Thanks you for replying. Here is traceback:
>
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
> self.result = application(self.environ, self.start_response)
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line
> 241, in __call__
> response = self.get_response(request)
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line
> 153, in get_response
> response = self.handle_uncaught_exception(request, resolver,
> sys.exc_info())
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line
> 228, in handle_uncaught_exception
> return callback(request, **param_dict)
>   File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py",
> line 91, in _wrapped_view
> response = view_func(request, *args, **kwargs)
>   File "/usr/local/lib/python2.7/dist-packages/django/views/defaults.py",
> line 32, in server_error
> t = loader.get_template(template_name) # You need to create a 500.html
> template.
>   File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py",
> line 145, in get_template
> template, origin = find_template(template_name)
>   File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py",
> line 138, in find_template
> raise TemplateDoesNotExist(name)
> TemplateDoesNotExist: 500.html
> [17/Aug/2012 10:11:59] "GET / HTTP/1.1" 500 59
>
>
> On Tuesday, 14 August 2012 14:59:11 UTC+1, Alexis Roda wrote:
>>
>> Al 14/08/12 12:50, En/na madala ha escrit:
>> >
>> > So I carried on and started tutorial 3 till I got halfway down and had
>> > to do same thing but no matter what I try can't get Django to recognize
>> > my directories.
>> >
>> > Can anyone see where I am going wrong please? thanks in anticipation.
>>
>> What error are you getting? template not found? please pastebin the
>> traceback.
>>
>>
>>
>> Regards
>
> --
> 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/-/fif5nO4VPsYJ.
>
> 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.



-- 
Thanks & Regards


Amyth [Admin - Techstricks]
Email - aroras.offic...@gmail.com, ad...@techstricks.com
Twitter - @a_myth_
http://techstricks.com/

-- 
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: Not reading from TEMPLATE_DIRS in settings.py

2012-08-17 Thread madala
Thanks you for replying. Here is traceback:
Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
  File 
"/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 
241, in __call__
response = self.get_response(request)
  File 
"/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 
153, in get_response
response = self.handle_uncaught_exception(request, resolver, 
sys.exc_info())
  File 
"/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 
228, in handle_uncaught_exception
return callback(request, **param_dict)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py", 
line 91, in _wrapped_view
response = view_func(request, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/views/defaults.py", 
line 32, in server_error
t = loader.get_template(template_name) # You need to create a 500.html 
template.
  File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py", 
line 145, in get_template
template, origin = find_template(template_name)
  File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py", 
line 138, in find_template
raise TemplateDoesNotExist(name)
TemplateDoesNotExist: 500.html
[17/Aug/2012 10:11:59] "GET / HTTP/1.1" 500 59


On Tuesday, 14 August 2012 14:59:11 UTC+1, Alexis Roda wrote:
>
> Al 14/08/12 12:50, En/na madala ha escrit: 
> > 
> > So I carried on and started tutorial 3 till I got halfway down and had 
> > to do same thing but no matter what I try can't get Django to recognize 
> > my directories. 
> > 
> > Can anyone see where I am going wrong please? thanks in anticipation. 
>
> What error are you getting? template not found? please pastebin the 
> traceback. 
>
>
>
> Regards 
>

-- 
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/-/fif5nO4VPsYJ.
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: Not reading from TEMPLATE_DIRS in settings.py

2012-08-17 Thread madala
Yes I can access the directories. Here's the traceback:
Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
  File 
"/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 
241, in __call__
response = self.get_response(request)
  File 
"/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 
153, in get_response
response = self.handle_uncaught_exception(request, resolver, 
sys.exc_info())
  File 
"/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 
228, in handle_uncaught_exception
return callback(request, **param_dict)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py", 
line 91, in _wrapped_view
response = view_func(request, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/views/defaults.py", 
line 32, in server_error
t = loader.get_template(template_name) # You need to create a 500.html 
template.
  File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py", 
line 145, in get_template
template, origin = find_template(template_name)
  File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py", 
line 138, in find_template
raise TemplateDoesNotExist(name)
TemplateDoesNotExist: 500.html
[17/Aug/2012 10:11:59] "GET / HTTP/1.1" 500 59


On Tuesday, 14 August 2012 14:54:45 UTC+1, ephan wrote:
>
> Have you checked the permissions of the directory and template 
> files? 
> run ls -l in the parent directory of the template folder and inside 
> the folder itself . 
> madala wrote: 
> > Have followed tutorial 2 instructions carefully. So far everything has 
> > worked as described in tutorials but cannot get django to load files 
> from 
> > my own template directory. Seems a very simple problem. 
> > 
> > here's the part of my settings.py: 
> > 
> > TEMPLATE_DIRS = ( 
> > '/home/madala/WebsiteCode/templates', 
> > "/home/madala/Website/templates", 
> > # Put strings here, like "/home/html/django_templates" or 
> > "C:/www/django/templates". 
> > # Always use forward slashes, even on Windows. 
> > # Don't forget to use absolute paths, not relative paths. 
> > ) 
> > 
> > So I carried on and started tutorial 3 till I got halfway down and had 
> to 
> > do same thing but no matter what I try can't get Django to recognize my 
> > directories. 
> > 
> > Can anyone see where I am going wrong please? thanks in anticipation. 
>

-- 
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/-/ZY30B5nRAEkJ.
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 sessions in Django

2012-08-17 Thread Amyth Arora
You're Welcome. Glad to Help.

On Fri, Aug 17, 2012 at 2:28 PM, Sandeep kaur  wrote:
> On Fri, Aug 17, 2012 at 1:39 PM, Amyth Arora  
> wrote:
>> I think this is because you are passing it the "Session Key" instead
>> of the "Session Instance", you need to get the session instance and
>> then pass it  to your function, Something like this:
>>
>> profile.sess = Session.objects.get(session_key=request.session.session_key)
>>
> Thanks a lot. This worked. :)
>
> --
> Sandeep Kaur
> E-Mail: mkaurkha...@gmail.com
> Blog: sandymadaan.wordpress.com
>
> --
> 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.
>



-- 
Best Regards,

Amyth Arora
http://techstricks.com

-- 
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: Using sessions in Django

2012-08-17 Thread Sandeep kaur
On Fri, Aug 17, 2012 at 1:39 PM, Amyth Arora  wrote:
> I think this is because you are passing it the "Session Key" instead
> of the "Session Instance", you need to get the session instance and
> then pass it  to your function, Something like this:
>
> profile.sess = Session.objects.get(session_key=request.session.session_key)
>
Thanks a lot. This worked. :)

-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.com

-- 
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: Using sessions in Django

2012-08-17 Thread Thomas Orozco
My mistake then, sorry about that!
Le 17 août 2012 10:34, "Tom Evans"  a écrit :

> On Fri, Aug 17, 2012 at 9:12 AM, Thomas Orozco
>  wrote:
> > Session key is the session 's primary key. Not the session itself.
> >
> > What you want to assign to your field is a session, not its key. So use
> > request.session.
> >
>
> This would not work; request.session is a
> django.contrib.sessions.backends,SessionBase subclass, and not a model
> instance.
>
> You would need to use the advice Amyth gave you.
>
> 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-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: Using sessions in Django

2012-08-17 Thread Tom Evans
On Fri, Aug 17, 2012 at 9:12 AM, Thomas Orozco
 wrote:
> Session key is the session 's primary key. Not the session itself.
>
> What you want to assign to your field is a session, not its key. So use
> request.session.
>

This would not work; request.session is a
django.contrib.sessions.backends,SessionBase subclass, and not a model
instance.

You would need to use the advice Amyth gave you.

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-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 sessions in Django

2012-08-17 Thread Thomas Orozco
I'm sorry, I have some trouble understanding exactly what you need, could
you please try and provide a bit more context ? :-)
Le 17 août 2012 10:27, "Sandeep kaur"  a écrit :

> On Fri, Aug 17, 2012 at 1:42 PM, Thomas Orozco
>  wrote:
> > Session key is the session 's primary key. Not the session itself.
> >
> > What you want to assign to your field is a session, not its key. So use
> > request.session.
> >
> > However.
> >
> > Please very careful when using FK' s to sessions, sessions are meant to
> be
> > short lived, and could / should be deleted once they expire (ie. When the
> > user logs off or after a specific duration), depending on your backend.
> >
> > I'm not sure what you're trying to achieve, but I think that FKing to
> > sessions is, at the very list, pretty risky.
> >
> > Especially given that the default on delete behavior of a ForeignKey is
> > cascade.
>
> You are right.
> Actually, I want a cart like system. Like in my project's case, if a
> client want to test multiple material in one job, it should generate
> one bill and receipt. But for each different material, different jobs
> are created. So, I thought it could be achieved by storing the session
> in which the user logged and then get the bill generated based on that
> session.
> If you find it a vague solution, do tell the most optimum solution.
>
>
> --
> Sandeep Kaur
> E-Mail: mkaurkha...@gmail.com
> Blog: sandymadaan.wordpress.com
>
> --
> 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: Using sessions in Django

2012-08-17 Thread Sandeep kaur
On Fri, Aug 17, 2012 at 1:42 PM, Thomas Orozco
 wrote:
> Session key is the session 's primary key. Not the session itself.
>
> What you want to assign to your field is a session, not its key. So use
> request.session.
>
> However.
>
> Please very careful when using FK' s to sessions, sessions are meant to be
> short lived, and could / should be deleted once they expire (ie. When the
> user logs off or after a specific duration), depending on your backend.
>
> I'm not sure what you're trying to achieve, but I think that FKing to
> sessions is, at the very list, pretty risky.
>
> Especially given that the default on delete behavior of a ForeignKey is
> cascade.

You are right.
Actually, I want a cart like system. Like in my project's case, if a
client want to test multiple material in one job, it should generate
one bill and receipt. But for each different material, different jobs
are created. So, I thought it could be achieved by storing the session
in which the user logged and then get the bill generated based on that
session.
If you find it a vague solution, do tell the most optimum solution.


-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.com

-- 
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: Using sessions in Django

2012-08-17 Thread Thomas Orozco
Session key is the session 's primary key. Not the session itself.

What you want to assign to your field is a session, not its key. So use
request.session.

However.

Please very careful when using FK' s to sessions, sessions are meant to be
short lived, and could / should be deleted once they expire (ie. When the
user logs off or after a specific duration), depending on your backend.

I'm not sure what you're trying to achieve, but I think that FKing to
sessions is, at the very list, pretty risky.

Especially given that the default on delete behavior of a ForeignKey is
cascade.
Le 17 août 2012 09:59, "Sandeep kaur"  a écrit :

> I am using session foreign key in my table.
>
> class ClientJob(models.Model): #models.py
>  .
>  sess = models.ForeignKey(Session)
>
> And in order to save its value in database, I used ,.
>
> def add_job(request)  #views.py
>  ...
>  if not request.session.exists(request.session.session_key):
> request.session.create()
>  profile.sess = request.session.session_key
>  profile.save()
>
> But when I execute my form and click on submit button, I get error as :
>
> ```Cannot assign "'b593c61453d7aad199078c66b9ad6b30'":
> "ClientJob.sess" must be a "Session" instance.
>
> I am a bit unclear about using sessions in django, so be a little
> elaborative.
>
> Thank you.
>
>
> --
> Sandeep Kaur
> E-Mail: mkaurkha...@gmail.com
> Blog: sandymadaan.wordpress.com
>
> --
> 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: Using sessions in Django

2012-08-17 Thread Amyth Arora
I think this is because you are passing it the "Session Key" instead
of the "Session Instance", you need to get the session instance and
then pass it  to your function, Something like this:

profile.sess = Session.objects.get(session_key=request.session.session_key)


On Fri, Aug 17, 2012 at 1:28 PM, Sandeep kaur  wrote:
> I am using session foreign key in my table.
>
> class ClientJob(models.Model): #models.py
>  .
>  sess = models.ForeignKey(Session)
>
> And in order to save its value in database, I used ,.
>
> def add_job(request)  #views.py
>  ...
>  if not request.session.exists(request.session.session_key):
> request.session.create()
>  profile.sess = request.session.session_key
>  profile.save()
>
> But when I execute my form and click on submit button, I get error as :
>
> ```Cannot assign "'b593c61453d7aad199078c66b9ad6b30'":
> "ClientJob.sess" must be a "Session" instance.
>
> I am a bit unclear about using sessions in django, so be a little elaborative.
>
> Thank you.
>
>
> --
> Sandeep Kaur
> E-Mail: mkaurkha...@gmail.com
> Blog: sandymadaan.wordpress.com
>
> --
> 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.
>



-- 
Best Regards,

Amyth Arora
http://techstricks.com

-- 
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: Adding Button in admin form

2012-08-17 Thread Thomas Orozco
I might be off, but I believe that they want to get a list of objects from
the database, a ForeignKey seems more appropriate here, or am I missing
something?
Le 17 août 2012 09:58, "Amyth Arora"  a écrit :

> Change the ModelField to type "CharField" and you should have a input
> box in the admin.
>
>
> On Fri, Aug 17, 2012 at 12:14 PM, Madhu  wrote:
> > Hello,
> >
> > I want to add the button along with field in admin form.
> >
> > ex. Field name "URL" with the "Choose Page" button.
> > If admin clicks on "Choose Page" button then some list from the database
> > table will be display and admin select any one from that list.
> >
> > Can anybody help me to add the button in admin form?
> >
> > Thanks,
> > Madhu
> >
> > --
> > 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/-/wSJXqEJkYzoJ.
> > 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.
>
>
>
> --
> Best Regards,
>
> Amyth Arora
> +91856363
> +918800212140
>
> --
> 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.



Using sessions in Django

2012-08-17 Thread Sandeep kaur
I am using session foreign key in my table.

class ClientJob(models.Model): #models.py
 .
 sess = models.ForeignKey(Session)

And in order to save its value in database, I used ,.

def add_job(request)  #views.py
 ...
 if not request.session.exists(request.session.session_key):
request.session.create()
 profile.sess = request.session.session_key
 profile.save()

But when I execute my form and click on submit button, I get error as :

```Cannot assign "'b593c61453d7aad199078c66b9ad6b30'":
"ClientJob.sess" must be a "Session" instance.

I am a bit unclear about using sessions in django, so be a little elaborative.

Thank you.


-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.com

-- 
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: Adding Button in admin form

2012-08-17 Thread Amyth Arora
Change the ModelField to type "CharField" and you should have a input
box in the admin.


On Fri, Aug 17, 2012 at 12:14 PM, Madhu  wrote:
> Hello,
>
> I want to add the button along with field in admin form.
>
> ex. Field name "URL" with the "Choose Page" button.
> If admin clicks on "Choose Page" button then some list from the database
> table will be display and admin select any one from that list.
>
> Can anybody help me to add the button in admin form?
>
> Thanks,
> Madhu
>
> --
> 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/-/wSJXqEJkYzoJ.
> 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.



-- 
Best Regards,

Amyth Arora
+91856363
+918800212140

-- 
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: Adding Button in admin form

2012-08-17 Thread Thomas Orozco
It's raw_id_fields! (see the docs for more detail : ) )

On your modeladmin, set that to a list including the name (as string) of
your field, and you should have what you want.

Let me know if I misunderstood.
Le 17 août 2012 09:47, "Thomas Orozco"  a écrit :

> Oh, yeah, sorry about that, it's an admin parameter that you must use,
> can't recall the exact name, but it's something like id only.
> Le 17 août 2012 09:41, "Madhu"  a écrit :
>
>> Thanks for the replay.
>>
>> Using foreign key it creates dropdown list, but i want the URL as the
>> character field and "Choose Page" button which having the function which
>> retrieves the database query list.
>>
>>
>> On Friday, August 17, 2012 12:51:35 PM UTC+5:30, Thomas Orozco wrote:
>>>
>>> If you're using a ForeignKey for this field, you'll get this behavior by
>>> default in the Django admin.
>>> Le 17 août 2012 08:45, "Madhu"  a écrit :
>>>
 Hello,

 I want to add the button along with field in admin form.

 ex. Field name "URL" with the "Choose Page" button.
 If admin clicks on "Choose Page" button then some list from the
 database table will be display and admin select any one from that list.

 Can anybody help me to add the button in admin form?

 Thanks,
 Madhu

 --
 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/-/**wSJXqEJkYzoJ
 .
 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/-/gsOd9uZzCUgJ.
>> 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: Adding Button in admin form

2012-08-17 Thread Thomas Orozco
Oh, yeah, sorry about that, it's an admin parameter that you must use,
can't recall the exact name, but it's something like id only.
Le 17 août 2012 09:41, "Madhu"  a écrit :

> Thanks for the replay.
>
> Using foreign key it creates dropdown list, but i want the URL as the
> character field and "Choose Page" button which having the function which
> retrieves the database query list.
>
>
> On Friday, August 17, 2012 12:51:35 PM UTC+5:30, Thomas Orozco wrote:
>>
>> If you're using a ForeignKey for this field, you'll get this behavior by
>> default in the Django admin.
>> Le 17 août 2012 08:45, "Madhu"  a écrit :
>>
>>> Hello,
>>>
>>> I want to add the button along with field in admin form.
>>>
>>> ex. Field name "URL" with the "Choose Page" button.
>>> If admin clicks on "Choose Page" button then some list from the database
>>> table will be display and admin select any one from that list.
>>>
>>> Can anybody help me to add the button in admin form?
>>>
>>> Thanks,
>>> Madhu
>>>
>>> --
>>> 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/-/**wSJXqEJkYzoJ
>>> .
>>> 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/-/gsOd9uZzCUgJ.
> 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: Auto login with external cookie from different system

2012-08-17 Thread Thomas Orozco
Huge props for having the python docs on localhost :-D
Le 16 août 2012 20:08, "Melvyn Sopacua"  a écrit :

> On 16-8-2012 6:02, Kurtis Mullins wrote:
>
> > Not all of us host the Python docs, locally, haha.
>
> Lies! But yea, forgot to check that so thanks :)
>
> --
> Melvyn Sopacua
>
> --
> 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: Adding Button in admin form

2012-08-17 Thread Madhu
Thanks for the replay.

Using foreign key it creates dropdown list, but i want the URL as the 
character field and "Choose Page" button which having the function which 
retrieves the database query list.


On Friday, August 17, 2012 12:51:35 PM UTC+5:30, Thomas Orozco wrote:
>
> If you're using a ForeignKey for this field, you'll get this behavior by 
> default in the Django admin. 
> Le 17 août 2012 08:45, "Madhu" > a 
> écrit :
>
>> Hello,
>>
>> I want to add the button along with field in admin form.
>>
>> ex. Field name "URL" with the "Choose Page" button.
>> If admin clicks on "Choose Page" button then some list from the database 
>> table will be display and admin select any one from that list.
>>
>> Can anybody help me to add the button in admin form?
>>
>> Thanks,
>> Madhu
>>
>> -- 
>> 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/-/wSJXqEJkYzoJ.
>> 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/-/gsOd9uZzCUgJ.
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 Admin doesn't show all fields from model when registered.

2012-08-17 Thread Thomas Orozco
This is not really django specific, several objects bearing the same name
in the same namespace will always lead to trouble ; )
(And this is not even python specific)

Glad you could fix it and thanks for posting your solution in case someone
else has the same issue though. : )
Le 16 août 2012 21:01, "Babatunde Akinyanmi"  a
écrit :

> Ok I fixed it and in case someone else falls into such a trap, here's
> how I fixed it.
>
> My Answer model had a field with name 'is_correct' and had a method
> with name 'is_correct'. This confused django such that:
>
> >>> ans = Answer.objects.get(id=1)
> >>> ans.is_correct
> >
>
> So I changed the name of the 'is_correct' method and running the above
> in the code threw an error: .DatabaseError: column
> examprep_answer.is_correct does not exist.
>
> Drop my database and syncdb-ing got things back to normal.
>
> I think django should be able to detect such things and raise an error
> or there should be a note in the documentation warning people not to
> name their model methods with model field names.
>
> On 8/16/12, Tundebabzy  wrote:
> > Hi guys, here's bit of my code http://dpaste.com/hold/787292/
> >
> > The problem is that my Answer model in admin is missing the 'is_correct',
> > 'date_added' and 'modified' fields.
> >
> >
> > <
> https://lh4.googleusercontent.com/-FuxmFXdGVP4/UC0K_dwpIhI/ADI/deTk9J_tQOE/s1600/Screenshot+from+2012-08-16+15%3A57%3A35.png
> >
> >
> > I tried adding:
> > fieldsets = [
> >
> > (None,   {'fields':
> > ['text','is_correct','explanation']}),
> >
> > ]
> > to my AnswerInLine definition but that throws an ImproperlyConfigured
> error
> > saying:
> > 'AnswerInline.fieldsets[0][1]['fields']' refers to field 'is_correct'
> that
> > is missing from the form.
> >
> > Can anyone help out?
> >
> >
> > --
> > 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/-/qK1kFc-11lQJ.
> > 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.
> >
> >
>
> --
> Sent from my mobile device
>
> --
> 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: django makemessages doesn't recognize trans in templates

2012-08-17 Thread Thomas Orozco
You gave us the project layout, but where are the templates?

My guess is that Django is basically not picking them templates *up*, but I
might be off.

There are arguments to the makemessages command that can help you indicate
the directory you want messages created for. You can also use higher
verbosity I think.
I'm sorry I can't name them on the top of my head though.
Le 17 août 2012 04:16, "Jojo"  a écrit :

> Hi, the subject should be a little clear so, this is the project folder
> structure
>
> project folder
>  locale
>   en
> LC_MESSAGES
>   django.po
>   es
> LC_MESSAGES
>   django.po
>   it
> LC_MESSAGES
>   django.po
>   project
> __init__.py
> mochileros
> settings.py
> urls.py
> wsgi.py
>   application folder
> models.py
> views.py
>
>
> I have created a locale folder and after I launched the django-admin.py
> makemessages command as explained in the documentation, but when I open a
> .po file (the command create the files actually), I can't found
> the msgid/msgstr relative to the translation instruction in my template
> files.
> This is my base template.
>
> {% load i18n %}
>
> 
> 
> ...
> 
> {% trans "home" %}
> {% trans "contacts" %}
> {% trans "about_us" %}
> ...
> 
>
>
> I have added the LocaleMiddleware in the settings file so, do I forgot
> something?
> Any suggestions?
>
>
> Thank you in advance
>
> --
> 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/-/QT9zFkTK5zwJ.
> 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: Adding Button in admin form

2012-08-17 Thread Thomas Orozco
If you're using a ForeignKey for this field, you'll get this behavior by
default in the Django admin.
Le 17 août 2012 08:45, "Madhu"  a écrit :

> Hello,
>
> I want to add the button along with field in admin form.
>
> ex. Field name "URL" with the "Choose Page" button.
> If admin clicks on "Choose Page" button then some list from the database
> table will be display and admin select any one from that list.
>
> Can anybody help me to add the button in admin form?
>
> Thanks,
> Madhu
>
> --
> 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/-/wSJXqEJkYzoJ.
> 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.