Re: Modify only one field

2012-02-03 Thread akaariai
On Feb 4, 9:10 am, Ashe  wrote:
> Is there a better solution to modify only the specified field on a
> table than :
> self.__class__.objects.filter(id=self.id).update(myfield='new awesome
> value')
> ?
> I have been looking for a cleaner solution for a long time without
> success, while waiting for that (https://code.djangoproject.com/ticket/4102
> ).
>
> If it is the best solution, is there any drawback with that solution ?
> I suppose there is a read on the database because of the
> objects.filter(). And we lose the possibility to use save() and
> clean() before update, which I usually enjoy to override.

That is the only available solution currently, apart of raw SQL which
is an often overlooked alternative.

You could do that update in an overridden .save method. Make it take a
kwarg 'update_fields=[],' or 'only_myfield=False'. Then, you can just
use model.save(only_myfield=True). The save method could then handle
all the necessary dirty details.

BTW even if there is a filter operation, there will be just only one
query. Actually, your method will be more effective than normal save,
as without force_update the current implementation of .save() needs to
first do a select, then update. You can see the queries made by using
django-debug-toolbar, or just by running this in the shell:
from django.db import connection
from django.conf import settings
settings.DEBUG = True
self.__class__.objects.filter(id=self.id).update(myfield='new awesome
value')
print connection.queries

 - Anssi

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



Modify only one field

2012-02-03 Thread Ashe
Hello,

Is there a better solution to modify only the specified field on a
table than :
self.__class__.objects.filter(id=self.id).update(myfield='new awesome
value')
?
I have been looking for a cleaner solution for a long time without
success, while waiting for that ( https://code.djangoproject.com/ticket/4102
).

If it is the best solution, is there any drawback with that solution ?
I suppose there is a read on the database because of the
objects.filter(). And we lose the possibility to use save() and
clean() before update, which I usually enjoy to override.

Regards,

--
Ashe

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



Checklist for appreciating a project from 1.2.7 to 1.4a1

2012-02-03 Thread Alec Taylor
Good afternoon,

I'm bringing the "social-commerce" project up to the latest trunk of
Pinax and Django.

Is there a checklist of things I'll need to update?

I've begun updating it, i.e. adding the new database dictionary:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
'read_default_file': '/path/to/my.cnf',
},
}
}

But it keeps giving me error after error once I've done that, so
instead of tackling issues one at a time, I thought their might be a
guide of some sort?

Thanks for all suggestions,

Alec Taylor

-- 
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: djangobench results (1.4 vs 1.3)

2012-02-03 Thread akaariai
I meant to post this to django-developers. But I guess this might be
interesting to django-users also, so not a big mistake... :)

 - Anssi

On Feb 4, 3:02 am, akaariai  wrote:
> I just completed some runs comparing performance of 1.4 vs 1.3 using
> Djangobench. There doesn't seem to be any repeatable significant
> regressions or gains except for these two tests:
>
> Running 'url_resolve' benchmark ...
> Min: 0.00 -> 0.00: incomparable (one result was zero)
> Avg: 0.92 -> 0.000142: 1.5424x slower
> Significant (t=-8.211439)
> Stddev: 0.9 -> 0.00010: 1.0696x larger (N = 500)
>
> Running 'url_reverse' benchmark ...
> Min: 0.00 -> 0.00: incomparable (one result was zero)
> Avg: 0.000100 -> 0.000168: 1.6761x slower
> Significant (t=-8.269947)
> Stddev: 0.00012 -> 0.00014: 1.1812x larger (N = 500)
>
> I don't know if 50% slowdown in these tests are critical. Maybe worth
> checking where the difference comes from.
>
> I also compared 1.4 vs 1.3 when USE_TZ was set to on. No regressions
> there.
>
> So, nothing really interesting found, which I guess is good news.
>
> BTW are there anybody who is running these kind of tests regularly? I
> mean is there any point of reporting these kind of finds, or are they
> already known?
>
>  - Anssi

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



djangobench results (1.4 vs 1.3)

2012-02-03 Thread akaariai
I just completed some runs comparing performance of 1.4 vs 1.3 using
Djangobench. There doesn't seem to be any repeatable significant
regressions or gains except for these two tests:

Running 'url_resolve' benchmark ...
Min: 0.00 -> 0.00: incomparable (one result was zero)
Avg: 0.92 -> 0.000142: 1.5424x slower
Significant (t=-8.211439)
Stddev: 0.9 -> 0.00010: 1.0696x larger (N = 500)

Running 'url_reverse' benchmark ...
Min: 0.00 -> 0.00: incomparable (one result was zero)
Avg: 0.000100 -> 0.000168: 1.6761x slower
Significant (t=-8.269947)
Stddev: 0.00012 -> 0.00014: 1.1812x larger (N = 500)

I don't know if 50% slowdown in these tests are critical. Maybe worth
checking where the difference comes from.

I also compared 1.4 vs 1.3 when USE_TZ was set to on. No regressions
there.

So, nothing really interesting found, which I guess is good news.

BTW are there anybody who is running these kind of tests regularly? I
mean is there any point of reporting these kind of finds, or are they
already known?

 - Anssi

-- 
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: Entering Text into a Database

2012-02-03 Thread akaariai
On Feb 4, 2:21 am, ds39  wrote:
> Thanks to everyone who took the time to respond. I've been looking at
> the godjango website, and its been very helpful with figuring out
> forms. I was able to modify some of the tutorial examples on the site,
> adding form.save(), to successfully enter text into the database. So,
> I think I've found my answer. The only other thing I was curious about
> was when and when not to use something like ModelForms with user-
> entered data. For instance, are there times when text responses
> associated with different users should be handled some other way ?

When it suits your needs. Sorry for the stupid answer :)

You have basically three ways to do form processing. ModelForms is the
easiest, everything is easy and magical. The only problem is that
there is happening a lot behind the scenes, and it can be hard to get
full control of things when using ModelForms. Next choice is regular
Forms. There isn't much magic, they take some data in, validate it and
convert the data into Python values. However, even this can sometimes
limit your options. So, the last way is to not use Django's forms at
all. Just use request.GET and request.POST directly. This can come
handy if you really need it. But you almost never need to go this
route.

So, if you find out that ModelForms are hindering your development
instead of accelerating it, try without ModelForms. Otherwise, there
really isn't any rules when to use what kind of form processing.

 - Anssi

-- 
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: Entering Text into a Database

2012-02-03 Thread ds39
Thanks to everyone who took the time to respond. I've been looking at
the godjango website, and its been very helpful with figuring out
forms. I was able to modify some of the tutorial examples on the site,
adding form.save(), to successfully enter text into the database. So,
I think I've found my answer. The only other thing I was curious about
was when and when not to use something like ModelForms with user-
entered data. For instance, are there times when text responses
associated with different users should be handled some other way ?

Thanks again


On Feb 3, 12:55 am, Mario Gudelj  wrote:
> Hey dude,
>
> Let's say you have some model with fields defined. It's called Business.
> Looks something like this:
>
> class Business(models.Model):
>     id = models.AutoField(primary_key=True)
>     name = models.CharField("Business Name", max_length=NAME, blank=False)
>
> You create a ModelForm like this:
>
> class BusinessDetailsForm(forms.ModelForm):
>     class Meta:
>         model = Business
>
> In your view you have a method that captures the POST and saves it inside
> the model:
>
> def save_business_details(request):
>     if request.POST:
>         form = BusinessDetailsForm(request.POST)
>         if form.is_valid():
>             form.save()
>             return
> HttpResponseRedirect(reverse("your_app.views.some_view_when_submission_is_s 
> uccessful",
> args=[]))
>     else:
>         here you pass back the form or whatever
>     return render_to_response(and render that whatever)
>
> So, form.save() will save the details.
>
> I hope that helps!
>
> -m
>
> On 3 February 2012 14:40, Python_Junkie wrote:
>
>
>
> > Not sure if this will help, but I have diverted from the standard
> > method of database updates taught in the tutorial.
>
> > I take a more traditional sql methodology
>
> > for example in any view that I am using.
>
> > I collect the data elements via a request
> > and then build a sql statement
>
> > for example
>
> > (The exact syntax may be a little off.)
>
> > var_1=request.post(name)
>
> > var_2=...etc
>
> > insert into table 1(col_1,col_2) values ('var_1,var_2)
>
> > commit
>
> > Let me know if this helps and I can update the syntax to be more
> > precise.
>
> > On Feb 2, 9:51 pm, ajohnston  wrote:
> > > On Feb 2, 2:30 pm, ds39  wrote:
> > > Is there any page, outside of the
>
> > > > official documentation, that gives an example from beginning to end
> > > > regarding how to save ModelForms in your database using views.py
> > > > rather than the shell (including sample URLs) ? Also, how would I
> > > > access the entered text via the shell to determine if it was saved ?
>
> > > Did you do the tutorial[1]?. Be sure to do all four parts. After that
> > > the examples in the ModelForms documentation[2] should make sense. If
> > > not, ask specific questions about what is not working the way you
> > > think it should. Good luck.
>
> > > {1]https://docs.djangoproject.com/en/dev/intro/tutorial01/
> > > [2]https://docs.djangoproject.com/en/1.3/topics/forms/modelforms/
>
> > --
> > 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: problem installing PIL

2012-02-03 Thread Stephan
You can download PIL for all py-versions and 64bit from
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil

-- 
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 installing PIL

2012-02-03 Thread NENAD CIKIC
Thanks, I have downloaded the instalation and I have managed to include the 
Imagefield in the model. Now will try it:)

-- 
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/-/BO9_W0yV3CEJ.
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-mptt compared w/ django-treebeard

2012-02-03 Thread Aljoša Mohorović
On Thu, Feb 2, 2012 at 8:13 PM, creecode  wrote:
> I wouldn't assume that just because something hasn't been updated for awhile
> that it isn't good.

like i said, i've used treebeard w/o problems so i don't think it's bad.
my question/interest is mostly because i've noticed that most projects use mptt.

Aljosa

-- 
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: import error

2012-02-03 Thread Thorsten Sanders
Did you try to add a $ after the last slash for the login, may that 
makes a difference for the url resolver, but dunno, just a wild guess.



Am 03.02.2012 18:39, schrieb Miten:

hi guys,
I am doing simple app for learning.  I created page and then auth
protected but as I added register link to login page it errors out on
import error.  I think its some thing to do with setup since created
new app for registration.  I have shown my setup and setting and
traceback at
http://dpaste.com/697051/
http://dpaste.com/697053/
http://dpaste.com/697144/

please take a look and advice.  I am able to import login from django
shell fine.

Regards,

Miten.



--
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 Snippet imports?

2012-02-03 Thread msbuck
Yes you need to put register = template.Library() in your module. See
https://docs.djangoproject.com/en/1.3/howto/custom-template-tags/ for
more info on where this code should reside.

On Feb 3, 9:17 am, Jesramz  wrote:
> source:http://djangosnippets.org/snippets/847/
>
> from django.contrib.auth.models import User, Group
> from django.utils.encoding import force_unicode
> from django import template
>
> Missing anything?
> Would I have to use 'register = template.Library()' ?

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



import error

2012-02-03 Thread Miten
hi guys,
I am doing simple app for learning.  I created page and then auth
protected but as I added register link to login page it errors out on
import error.  I think its some thing to do with setup since created
new app for registration.  I have shown my setup and setting and
traceback at
http://dpaste.com/697051/
http://dpaste.com/697053/
http://dpaste.com/697144/

please take a look and advice.  I am able to import login from django
shell fine.

Regards,

Miten.

-- 
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: FREE Full Django Tutorial

2012-02-03 Thread yati sagade
Hi
Looks really good. Appreciate the hard work man :) Already favourited it.
Keep up the good work!

Cheers!
Yati Sagade

On Fri, Feb 3, 2012 at 10:29 PM, programmersbook.com <
webmas...@programmersbook.com> wrote:

> Thank you for your email. I'm not quite sure what you mean, could you
> please elaborate?
>
> On Feb 3, 4:45 pm, Aaron Cannon 
> wrote:
> > Any plans to release a video podcast?
> >
> > Aaron
> >
> > On 2/3/12, programmersbook.com  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hi All,
> >
> > > I created a full django turtorial screencast, so far 25, every week
> > > I'm adding one more.
> >
> > >
> http://www.youtube.com/playlist?list=PL385A53B00B8B158E&feature=view_all
> >
> > > Let me know what you think.
> >
> > > Best,
> >
> > > --
> > > 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.
>
>


-- 
Yati Sagade 

(@yati_itay )

-- 
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: FREE Full Django Tutorial

2012-02-03 Thread programmersbook.com
Thank you for your email. I'm not quite sure what you mean, could you
please elaborate?

On Feb 3, 4:45 pm, Aaron Cannon 
wrote:
> Any plans to release a video podcast?
>
> Aaron
>
> On 2/3/12, programmersbook.com  wrote:
>
>
>
>
>
>
>
> > Hi All,
>
> > I created a full django turtorial screencast, so far 25, every week
> > I'm adding one more.
>
> >http://www.youtube.com/playlist?list=PL385A53B00B8B158E&feature=view_all
>
> > Let me know what you think.
>
> > Best,
>
> > --
> > 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: FREE Full Django Tutorial

2012-02-03 Thread Aaron Cannon
Any plans to release a video podcast?

Aaron

On 2/3/12, programmersbook.com  wrote:
> Hi All,
>
> I created a full django turtorial screencast, so far 25, every week
> I'm adding one more.
>
> http://www.youtube.com/playlist?list=PL385A53B00B8B158E&feature=view_all
>
> Let me know what you think.
>
>
> Best,
>
> --
> 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 Snippet imports?

2012-02-03 Thread Jesramz
source: http://djangosnippets.org/snippets/847/

from django.contrib.auth.models import User, Group
from django.utils.encoding import force_unicode
from django import template

Missing anything?
Would I have to use 'register = template.Library()' ?



-- 
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: Help Me With omab/django-socialauth

2012-02-03 Thread Matías Aguirre
Django-social-auth (note the hyphen ;)) uses LOGIN_URL as the URL to redirect
in case of errors if LOGIN_ERROR_URL is not defined, you might be getting an
error and being redirected to your LOGIN_URL and as your value is
/login/twitter/ you are restarting the process again.

Another possible flaw is your SOCIAL_AUTH_ENABLED_BACKENDS = ('twitter')
you should add a comma after the value or it won't be a valid tuple, like this:

SOCIAL_AUTH_ENABLED_BACKENDS = ('twitter',)

Regards,
Matías

Excerpts from coded kid's message of 2012-02-03 12:57:57 -0200:
> Yes, I've tried it. What's the main url you guys put in your
> LOGIN_URL? Because mine is '/login/twitter/' thats where the problem
> is.
> 
> On Feb 3, 10:46 am, Kevin  wrote:
> > Did you take a look at the example project?
> >
> > https://github.com/omab/django-social-auth/tree/master/example
> >
> > Compare it with your own project, or even use this example project as
> > a base for your own project.
> >
> > If all your urls.py contains is "url(r'',
> > include('social_auth.urls')), " and no other definitions, this could
> > be why it redirecting, as it cannot find the URL it's suppose to land
> > on.  Check the output in the Windows command window and see what URLs
> > are being requested and see if there's anything odd.
> >
> > On Feb 3, 2:12 am, coded kid  wrote:
> >
> >
> >
> > > Just keep getting redirect error. My Api keys are correct. Do you use
> > > the same LOGIN URL with the one above? Whats the main login url to
> > > twitter auth form?
> >
> > > On Feb 2, 5:23 pm, Thorsten Sanders  wrote:
> >
> > > > I took your config and its working fine, maybe your twitter api key is
> > > > wrong?
> >
> > > > On 02.02.2012 11:22, coded kid wrote:
> >
> > > > > I'm getting a redirect loop error. Whats the probs?
> >
> > > > > On Feb 1, 1:22 pm, Thorsten Sanders  wrote:
> > > > >> Some sort of error traceback/description would be helpful, from a 
> > > > >> quick
> > > > >> look it seems all right.
> >
> > > > >> On 01.02.2012 13:23, coded kid wrote:
> >
> > > > >>> Hey guys, I'm facing a huge  problem with omab/django/socialauth.
> > > > >>> After setting all the necessary settings, I clicked on the Enter
> > > > >>> using Twitter link on my homepage, it couldn t redirect me to where 
> > > > >>> I
> > > > >>> will enter my twitter username and password. Below are my settings.
> > > > >>> In settings.py
> > > > >>> INSTALLED_APPS = (
> > > > >>> 'social_auth',
> > > > >>> }
> > > > >>> TEMPLATE_CONTEXT_PROCESSORS = (
> > > > >>>      "django.core.context_processors.auth",
> > > > >>>      "django.core.context_processors.debug",
> > > > >>>      "django.core.context_processors.i18n",
> > > > >>>      "django.core.context_processors.media",
> > > > >>>      "django.core.context_processors.static",
> > > > >>>     "django.contrib.messages.context_processors.messages",
> > > > >>>     "django.core.context_processors.request",
> > > > >>>      social_auth.context_processors.social_auth_by_type_backends ,
> > > > >>> )
> > > > >>> AUTHENTICATION_BACKENDS = (
> > > > >>>      'social_auth.backends.twitter.TwitterBackend',
> > > > >>>     'django.contrib.auth.backends.ModelBackend',
> > > > >>> )
> > > > >>> SOCIAL_AUTH_ENABLED_BACKENDS = ('twitter')
> > > > >>> TWITTER_CONSUMER_KEY         = '0hdgdhsnmzHDGDK'
> > > > >>> TWITTER_CONSUMER_SECRET      = 'YyNngsgw[1jw lcllcleleedfejewjuw'
> > > > >>> LOGIN_URL = '/accounts/login/' #login form for users to log in with
> > > > >>> their username and password!
> > > > >>> SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/homi/'  #page after user get
> > > > >>> authenticated
> > > > >>> SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = '/homi/'   '  #page after
> > > > >>> user get authenticated
> > > > >>> SOCIAL_AUTH_ERROR_KEY='social_errors'
> > > > >>> SOCIAL_AUTH_COMPLETE_URL_NAME  = 'socialauth_complete'
> > > > >>> SOCIAL_AUTH_ASSOCIATE_URL_NAME = 'socialauth_associate_complete'
> > > > >>> from django.template.defaultfilters import slugify
> > > > >>> SOCIAL_AUTH_USERNAME_FIXER = lambda u: slugify(u)
> > > > >>> SOCIAL_AUTH_UUID_LENGTH = 16
> > > > >>> SOCIAL_AUTH_EXTRA_DATA = False
> > > > >>> In urls.py
> > > > >>> url(r'', include('social_auth.urls')),
> > > > >>> In my template:
> > > > >>> 
> > > > >>>    Enter using 
> > > > >>> Twitter > > > >>> a>
> > > > >>>    
> > > > >>> 
> > > > >>> What do you think I m doing wrong? Hope to hear from you soon. 
> > > > >>> Thanks
> > > > >>> so much!
> > > > >>> N:B : I m coding on windows machine. And in the development
> > > > >>> environment using localhost:8000.
-- 
Matías Aguirre (matiasagui...@gmail.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: Help Me With omab/django-socialauth

2012-02-03 Thread coded kid
Yes, I've tried it. What's the main url you guys put in your
LOGIN_URL? Because mine is '/login/twitter/' thats where the problem
is.

On Feb 3, 10:46 am, Kevin  wrote:
> Did you take a look at the example project?
>
> https://github.com/omab/django-social-auth/tree/master/example
>
> Compare it with your own project, or even use this example project as
> a base for your own project.
>
> If all your urls.py contains is "url(r'',
> include('social_auth.urls')), " and no other definitions, this could
> be why it redirecting, as it cannot find the URL it's suppose to land
> on.  Check the output in the Windows command window and see what URLs
> are being requested and see if there's anything odd.
>
> On Feb 3, 2:12 am, coded kid  wrote:
>
>
>
> > Just keep getting redirect error. My Api keys are correct. Do you use
> > the same LOGIN URL with the one above? Whats the main login url to
> > twitter auth form?
>
> > On Feb 2, 5:23 pm, Thorsten Sanders  wrote:
>
> > > I took your config and its working fine, maybe your twitter api key is
> > > wrong?
>
> > > On 02.02.2012 11:22, coded kid wrote:
>
> > > > I'm getting a redirect loop error. Whats the probs?
>
> > > > On Feb 1, 1:22 pm, Thorsten Sanders  wrote:
> > > >> Some sort of error traceback/description would be helpful, from a quick
> > > >> look it seems all right.
>
> > > >> On 01.02.2012 13:23, coded kid wrote:
>
> > > >>> Hey guys, I'm facing a huge  problem with omab/django/socialauth.
> > > >>> After setting all the necessary settings, I clicked on the Enter
> > > >>> using Twitter link on my homepage, it couldn t redirect me to where I
> > > >>> will enter my twitter username and password. Below are my settings.
> > > >>> In settings.py
> > > >>> INSTALLED_APPS = (
> > > >>> 'social_auth',
> > > >>> }
> > > >>> TEMPLATE_CONTEXT_PROCESSORS = (
> > > >>>      "django.core.context_processors.auth",
> > > >>>      "django.core.context_processors.debug",
> > > >>>      "django.core.context_processors.i18n",
> > > >>>      "django.core.context_processors.media",
> > > >>>      "django.core.context_processors.static",
> > > >>>     "django.contrib.messages.context_processors.messages",
> > > >>>     "django.core.context_processors.request",
> > > >>>      social_auth.context_processors.social_auth_by_type_backends ,
> > > >>> )
> > > >>> AUTHENTICATION_BACKENDS = (
> > > >>>      'social_auth.backends.twitter.TwitterBackend',
> > > >>>     'django.contrib.auth.backends.ModelBackend',
> > > >>> )
> > > >>> SOCIAL_AUTH_ENABLED_BACKENDS = ('twitter')
> > > >>> TWITTER_CONSUMER_KEY         = '0hdgdhsnmzHDGDK'
> > > >>> TWITTER_CONSUMER_SECRET      = 'YyNngsgw[1jw lcllcleleedfejewjuw'
> > > >>> LOGIN_URL = '/accounts/login/' #login form for users to log in with
> > > >>> their username and password!
> > > >>> SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/homi/'  #page after user get
> > > >>> authenticated
> > > >>> SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = '/homi/'   '  #page after
> > > >>> user get authenticated
> > > >>> SOCIAL_AUTH_ERROR_KEY='social_errors'
> > > >>> SOCIAL_AUTH_COMPLETE_URL_NAME  = 'socialauth_complete'
> > > >>> SOCIAL_AUTH_ASSOCIATE_URL_NAME = 'socialauth_associate_complete'
> > > >>> from django.template.defaultfilters import slugify
> > > >>> SOCIAL_AUTH_USERNAME_FIXER = lambda u: slugify(u)
> > > >>> SOCIAL_AUTH_UUID_LENGTH = 16
> > > >>> SOCIAL_AUTH_EXTRA_DATA = False
> > > >>> In urls.py
> > > >>> url(r'', include('social_auth.urls')),
> > > >>> In my template:
> > > >>> 
> > > >>>    Enter using 
> > > >>> Twitter > > >>> a>
> > > >>>    
> > > >>> 
> > > >>> What do you think I m doing wrong? Hope to hear from you soon. Thanks
> > > >>> so much!
> > > >>> N:B : I m coding on windows machine. And in the development
> > > >>> environment using localhost:8000.

-- 
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: Views in django

2012-02-03 Thread Weldan
Calculate in view, in template should print values .  Can group it in dict
i think.
 On Feb 3, 2012 10:39 PM, "Sandeep kaur"  wrote:

> On Fri, Feb 3, 2012 at 7:52 PM, Weldan  wrote:
> > Entries.objects.count()
> >
> That will be applicable if I want to his for only 1 table's entry.
> But here I have views as :
>
>cd = form.cleaned_data
>name_and_address = cd['name_and_address']
>title = get_object_or_404(Variable, pk='1')
>sign = get_object_or_404(Variable, pk='3')
>from TCC11_12.automation.choices import *
>client =
> ClientJob.objects.filter(name_and_address=name_and_address)
>amount = Amount.objects.all()
>suspence = Suspence.objects.all()
>
> and for this I have template as :
>
>   {% if client %}
>{% for clients in client %}
>{% for amounts in amount %}
>
> {% if clients.job_no == amounts.job_no %}
>
> {% if clients.name_and_address == clients.name_and_address %}
>
>{{ clients.receipt_no }}
> {{ clients.date }}
>{{amounts.total}}
>{{amounts.net_total}}
>{% endif  %}
>
>{% endif  %}
>
>{% endfor %}
>
>{% endfor %}
> {% endif %}
>
>
> When all this is applied, it creates a view out of 2 tables i.e Amount
> and ClientJob without using foreign key. Now I want to have sum of the
> total and net_total fields for the views generated.
>
> --
> 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: Views in django

2012-02-03 Thread Sandeep kaur
On Fri, Feb 3, 2012 at 7:52 PM, Weldan  wrote:
> Entries.objects.count()
>
That will be applicable if I want to his for only 1 table's entry.
But here I have views as :

cd = form.cleaned_data
name_and_address = cd['name_and_address']
title = get_object_or_404(Variable, pk='1')
sign = get_object_or_404(Variable, pk='3')
from TCC11_12.automation.choices import *
client =
ClientJob.objects.filter(name_and_address=name_and_address)
amount = Amount.objects.all()
suspence = Suspence.objects.all()

and for this I have template as :

   {% if client %}
{% for clients in client %}
{% for amounts in amount %}

 {% if clients.job_no == amounts.job_no %}

 {% if clients.name_and_address == clients.name_and_address %}

{{ clients.receipt_no }}
 {{ clients.date }}
{{amounts.total}}
{{amounts.net_total}}
{% endif  %}

{% endif  %}

{% endfor %}

{% endfor %}
{% endif %}


When all this is applied, it creates a view out of 2 tables i.e Amount
and ClientJob without using foreign key. Now I want to have sum of the
total and net_total fields for the views generated.

-- 
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: Views in django

2012-02-03 Thread Weldan
Entries.objects.count()
On Feb 3, 2012 10:12 PM, "Sandeep kaur"  wrote:

> Can I apply some operations on the views ( of database) that are
> created by me?  Eg: to do sum of some filtered entries. If yes, then
> how?
>
> --
> 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.



Views in django

2012-02-03 Thread Sandeep kaur
Can I apply some operations on the views ( of database) that are
created by me?  Eg: to do sum of some filtered entries. If yes, then
how?

-- 
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: Rooting my application at the base (/) of the URL

2012-02-03 Thread Daniel Roseman
On Thursday, 2 February 2012 20:14:57 UTC, Johan wrote:
>
> Hi 
>
>   I have deployed my application on Apache using WSGI, using 
> WSGIScriptAlias / /var/www/site/django.wsgi. Everything looks very 
> good. My actual application lives at http:///application. So 
> with the setup above when I browse to http:// django 404 page. I get this even if I add a .htaccess file ro 
> redirect / to /application. I can understand why this happening, it 
> because the wsgi script is rooted at / so the .htaccess file is never 
> utilized. If I change the WSGIScript alias setting to be 
> WSGIScriptAlias /application /var/www/site/django.wsgi. Then 
> the .htaccess file gets invoked but django stops working. 
>
>  So if anybody has any idea what I'm doing wrong above that would be 
> appreciated. 
>
>  In the meantime what would also work is to add an entry in the main 
> application's urls.py to redirect / to /application. But I don't know 
> how to do this. So any help would be appreciated. 
>
> Thanks 
>

Your question is a little bit confusing. Django's URLconfs don't really 
care about applications, except in as much as can choose to group a set of 
urls into an application's own urls.py if you want to. There's nothing that 
forces you to route all requests to application `foo` to /foo/whatever: if 
you want `foo` to be responsible for answering requests at `/`, then just 
configure it that way:

(r'^$', 'foo.views.main')

or include the whole sub urls.py at the root url:

(r'^', include('foo.urls'))

--
DR.

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



FREE Full Django Tutorial

2012-02-03 Thread programmersbook.com
Hi All,

I created a full django turtorial screencast, so far 25, every week
I'm adding one more.

http://www.youtube.com/playlist?list=PL385A53B00B8B158E&feature=view_all

Let me know what you think.


Best,

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



Error in code send Email

2012-02-03 Thread Abhishek Srivastava
Hi All,

import smtplib

mail="[hidden email]";
subject="Hai";
msg = 'Some Text';

smtp_server = smtplib.SMTP( 'mail.%s' % mail.split( '@' )[-1] )
smtp_server.sendmail(
mail
, [ mail ]
, 'Subject: %s\n' % subject
+ 'To: %s\n' % mail
+ '\n'
+ msg
)


I am using above code to send an Email, for this i am not installed
any SMTP setup my local , I just given import smtplib
and I am getting following error "AttributeError: 'module' object has
no attribute 'create_connection'"


can any one tell that how to give STMP server setup in my local and
run successfully the above code.

Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\ext
\webapp\__init__.py", line 500, in __call__

handler.post(*groups)
File "C:\Documents and Settings\desk\Desktop\apps\temp\main.py", line
129, in post
smtp_server = smtplib.SMTP( 'mail.%s' % mail.split( '@' )[-1] )
File "C:\Python26\lib\smtplib.py", line 239, in __init__

(code, msg) = self.connect(host, port)
File "C:\Python26\lib\smtplib.py", line 295, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "C:\Python26\lib\smtplib.py", line 273, in _get_socket

return socket.create_connection((port, host), timeout)
AttributeError: 'module' object has no attribute 'create_connection'

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



Error in code in send Email

2012-02-03 Thread Abhishek Srivastava
Hi All,

I am using below given code to send email. When i am running this
code, i am getting  "You are not currently sending out real email.  If
you have sendmail installed you can use it by using the server with --
enable_sendmail" message on console. I am totally unable to solve this
issue. Please let me know the solution and reason for this issue as
soon as possible. It is very imp for me now.


In settings.py

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'yourem...@gmail.com'
EMAIL_HOST_PASSWORD = 'yourpassword'
EMAIL_PORT = 587


>>> from django.core.mail import send_mail
>>> send_mail('Test', 'This is a test', 'f...@somewhere.com', 
>>> ['yourem...@somewhere.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.



Error in send Email

2012-02-03 Thread Abhishek Srivastava
Hi All,

I am using below given code to send email. When i am running this
code, i am getting  "You are not currently sending out real email.  If
you have sendmail installed you can use it by using the server with --
enable_sendmail" message on console. I am totally unable to solve this
issue. Please let me know the solution and reason for this issue as
soon as possible. It is very imp for me now.

from google.appengine.api import mail

mail.send_mail(sender="support@xxx",

 to="Albert Johnson ",

 subject="Your account has been approved",
 body="""

Dear Albert:

Your example.com account has been approved.  You can now visit
http://www.example.com/ and sign in using your Google Account to

access new features.

Please let us know if you have any questions.

The example.com Team
""")

Thanks In Advance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Need help regarding url patterns

2012-02-03 Thread akaariai
On Feb 3, 2:50 pm, ankitrocks  wrote:
> Hi.
> Thanks for replying.
>
> The reason  I used login/logout multiple times in the urls.py because
> i was unable to redirect from polls/03/logout to polls/login. When I
> am using href="../logout" , it works but sometimes when I am in
> level-2 in doesnt work.
> Please ignore the parameters of poll id in login/logout. Its just that
> I was trying something and forgot to remove the code.
>
> Now I went through reverse thing. I didnt get an idea about how do I
> redirect from a logout link in any page to polls/logout and also the
> url in the address bar should change. Please help me out.

I don't get what "url in address bar should change". So, the answer
might not be to your question...

Basically, you want to use the url template tag, from the
documentation:
{% url path.to.some_view v1 v2 %}

In your case, this would be something like:
Logout
That is, you are fetching the url for polls.views.logout_view without
any arguments. Detail view for poll no 1 would be something like this:
View poll No. 1

This is very basic introduction to Django's url resolving. And the
given code might actually not work correctly, haven't tested it. It
should contain the idea, though. I suggest you use some time learning
more about the url resolving system, it is time well spent.

You do not need (or want) to have multiple URLs defined for the
logout_view. That is, remove the logout_view mapping with poll_id
argument.

 - Anssi

-- 
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: Need help regarding url patterns

2012-02-03 Thread ankitrocks
Hi.
Thanks for replying.

The reason  I used login/logout multiple times in the urls.py because
i was unable to redirect from polls/03/logout to polls/login. When I
am using href="../logout" , it works but sometimes when I am in
level-2 in doesnt work.
Please ignore the parameters of poll id in login/logout. Its just that
I was trying something and forgot to remove the code.

Now I went through reverse thing. I didnt get an idea about how do I
redirect from a logout link in any page to polls/logout and also the
url in the address bar should change. Please help me out.




On Feb 3, 12:06 am, akaariai  wrote:
> On Feb 2, 4:57 pm, ankitrocks  wrote:
>
> > Please take a look at the following files:
>
> >http://pastebin.com/F86G9XJn
>
> >http://pastebin.com/p6gArpuG
>
> >http://pastebin.com/zxNHVHbV
>
> >http://pastebin.com/Rf9Kg9jf
>
> > Now my problem is that, I want all the logout links in the templates
> > point to polls/login and this change should also be reflected in the
> > url on my address bar. Same holds for home link which should point to
> > polls/welcome .
>
> Two quick pointers:
>   - You probably want to use the reverse method and the url template
> tag. Django documentation will tell you more about these.
>   - Why does the login/logout views take optional poll_id argument
> which is then not used. You should have the login and logout views
> only once defined in your urls.py, that is, not also under /id/login.
>
>  - Anssi

-- 
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: Rooting my application at the base (/) of the URL

2012-02-03 Thread bruno desthuilliers
On Feb 2, 9:14 pm, Johan  wrote:
> Hi
>
>   I have deployed my application on Apache using WSGI, using
> WSGIScriptAlias / /var/www/site/django.wsgi. Everything looks very
> good. My actual application lives at http:///application. So
> with the setup above when I browse to http:// django 404 page. I get this even if I add a .htaccess file ro
> redirect / to /application. I can understand why this happening, it
> because the wsgi script is rooted at / so the .htaccess file is never
> utilized. If I change the WSGIScript alias setting to be
> WSGIScriptAlias /application /var/www/site/django.wsgi. Then
> the .htaccess file gets invoked but django stops working.

If you want your django app to be the root of your django project, you
just have to fix your root urls.py. FWW, here's the relevant part of
my current project's root url.py:

urlpatterns = patterns(
'',
url(r'^$', main_views.home, name="home"),
url(r'^blookshop/', include('blookshop.urls')),
url(r'^admin/', include(admin.site.urls)),
   )


>  In the meantime what would also work is to add an entry in the main
> application's urls.py to redirect / to /application. But I don't know
> how to do this. So any help would be appreciated.

googling +django +redirect +view, I get the answer at the very top of
the list.

-- 
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: Help Me With omab/django-socialauth

2012-02-03 Thread Kevin
Did you take a look at the example project?

https://github.com/omab/django-social-auth/tree/master/example

Compare it with your own project, or even use this example project as
a base for your own project.

If all your urls.py contains is "url(r'',
include('social_auth.urls')), " and no other definitions, this could
be why it redirecting, as it cannot find the URL it's suppose to land
on.  Check the output in the Windows command window and see what URLs
are being requested and see if there's anything odd.

On Feb 3, 2:12 am, coded kid  wrote:
> Just keep getting redirect error. My Api keys are correct. Do you use
> the same LOGIN URL with the one above? Whats the main login url to
> twitter auth form?
>
> On Feb 2, 5:23 pm, Thorsten Sanders  wrote:
>
>
>
>
>
>
>
> > I took your config and its working fine, maybe your twitter api key is
> > wrong?
>
> > On 02.02.2012 11:22, coded kid wrote:
>
> > > I'm getting a redirect loop error. Whats the probs?
>
> > > On Feb 1, 1:22 pm, Thorsten Sanders  wrote:
> > >> Some sort of error traceback/description would be helpful, from a quick
> > >> look it seems all right.
>
> > >> On 01.02.2012 13:23, coded kid wrote:
>
> > >>> Hey guys, I'm facing a huge  problem with omab/django/socialauth.
> > >>> After setting all the necessary settings, I clicked on the Enter
> > >>> using Twitter link on my homepage, it couldn t redirect me to where I
> > >>> will enter my twitter username and password. Below are my settings.
> > >>> In settings.py
> > >>> INSTALLED_APPS = (
> > >>> 'social_auth',
> > >>> }
> > >>> TEMPLATE_CONTEXT_PROCESSORS = (
> > >>>      "django.core.context_processors.auth",
> > >>>      "django.core.context_processors.debug",
> > >>>      "django.core.context_processors.i18n",
> > >>>      "django.core.context_processors.media",
> > >>>      "django.core.context_processors.static",
> > >>>     "django.contrib.messages.context_processors.messages",
> > >>>     "django.core.context_processors.request",
> > >>>      social_auth.context_processors.social_auth_by_type_backends ,
> > >>> )
> > >>> AUTHENTICATION_BACKENDS = (
> > >>>      'social_auth.backends.twitter.TwitterBackend',
> > >>>     'django.contrib.auth.backends.ModelBackend',
> > >>> )
> > >>> SOCIAL_AUTH_ENABLED_BACKENDS = ('twitter')
> > >>> TWITTER_CONSUMER_KEY         = '0hdgdhsnmzHDGDK'
> > >>> TWITTER_CONSUMER_SECRET      = 'YyNngsgw[1jw lcllcleleedfejewjuw'
> > >>> LOGIN_URL = '/accounts/login/' #login form for users to log in with
> > >>> their username and password!
> > >>> SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/homi/'  #page after user get
> > >>> authenticated
> > >>> SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = '/homi/'   '  #page after
> > >>> user get authenticated
> > >>> SOCIAL_AUTH_ERROR_KEY='social_errors'
> > >>> SOCIAL_AUTH_COMPLETE_URL_NAME  = 'socialauth_complete'
> > >>> SOCIAL_AUTH_ASSOCIATE_URL_NAME = 'socialauth_associate_complete'
> > >>> from django.template.defaultfilters import slugify
> > >>> SOCIAL_AUTH_USERNAME_FIXER = lambda u: slugify(u)
> > >>> SOCIAL_AUTH_UUID_LENGTH = 16
> > >>> SOCIAL_AUTH_EXTRA_DATA = False
> > >>> In urls.py
> > >>> url(r'', include('social_auth.urls')),
> > >>> In my template:
> > >>> 
> > >>>    Enter using Twitter > >>> a>
> > >>>    
> > >>> 
> > >>> What do you think I m doing wrong? Hope to hear from you soon. Thanks
> > >>> so much!
> > >>> N:B : I m coding on windows machine. And in the development
> > >>> environment using localhost:8000.

-- 
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-mptt compared w/ django-treebeard

2012-02-03 Thread Matt Stevens
*I used django-mptt (combined with FeinCMS's TreeEditor) on a few of my
Django sites, it's brilliant.*
*Any questions I've had have been quickly answered, usually by the
maintainer** Craig de Stigter… he's pretty sharp.*
*
*
*
*
*Matt. Stevens | www.dirtymonkey.co.uk*

On Wed, Feb 1, 2012 at 5:46 PM, Aljosa Mohorovic  wrote:

> when using django-mptt or django-treebeard did anybody have bad
> experience?
> i've used treebeard before w/o problems but it looks like mptt is
> maintained and has newer releases and treebeard last release was in
> 2010.
>
> can anybody comment on possible future development/maintenance for
> these projects?
>
> --
> 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.



how do I model an auto-populate name from admin authorised users list

2012-02-03 Thread Krondaj
Hi,

I have written a model for a web form (of sorts) I'm making that
people can fill in from the admin site.  I have set permissions from
the admin end so they can only write or change new posts of the form
(see http://dpaste.org/BZ5Nm/). it's still work in progress  but I
have two problems.

First instead of using a CharField to take their name, i'd like it to
auto populate, there full name and email address as they will be
logged in and authenticated at the admin login site.


Secondly instead of having a set of name choices for the approver i'd
like to make a group in the admin called approver, and have it let you
select from a list (so if we have a new approver i can just add them
to the group).  I know how to make the group, i just don't know how to
get the model to display these in the admin site as a drop-down list.

I'd also like the database to link the first form and the second
form... and make it so only the person who has been requested to do
the work can fill in the required fields.

Can anyone give me some clues/ell me how to do this My coding
skillz are somewhat lacking!!??!! so i'd really appreciate any help!

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



Re: about QuerySet

2012-02-03 Thread akaariai


On Feb 3, 5:52 am, newme  wrote:
> so it means when i call user[1] after user[0], it is possible that i
> will get same record if someone else insert a new record into database
> between 2 calls.

Actually, there doesn't need to be an insert between the calls if you
don't use .order_by(). Technically, without an ORDER BY the database
is free to return the records in any order it wishes, even if there
are no inserts in between.

I think you really should fetch all the needed objects in one go. That
is the correct way to do what you need. And in addition it is more
efficient.

 - Anssi

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



Re: I need a package.

2012-02-03 Thread Donald Stufft
https://github.com/eldarion/user_messages 


On Friday, February 3, 2012 at 3:16 AM, coded kid wrote:

> Anyone knows about a django package that can be use by users to send
> private messages to each other?


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



I need a package.

2012-02-03 Thread coded kid
Anyone knows about a django package that can be use by users to send
private messages to each other?

-- 
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: Help Me With omab/django-socialauth

2012-02-03 Thread coded kid
Just keep getting redirect error. My Api keys are correct. Do you use
the same LOGIN URL with the one above? Whats the main login url to
twitter auth form?

On Feb 2, 5:23 pm, Thorsten Sanders  wrote:
> I took your config and its working fine, maybe your twitter api key is
> wrong?
>
> On 02.02.2012 11:22, coded kid wrote:
>
>
>
> > I'm getting a redirect loop error. Whats the probs?
>
> > On Feb 1, 1:22 pm, Thorsten Sanders  wrote:
> >> Some sort of error traceback/description would be helpful, from a quick
> >> look it seems all right.
>
> >> On 01.02.2012 13:23, coded kid wrote:
>
> >>> Hey guys, I'm facing a huge  problem with omab/django/socialauth.
> >>> After setting all the necessary settings, I clicked on the Enter
> >>> using Twitter link on my homepage, it couldn t redirect me to where I
> >>> will enter my twitter username and password. Below are my settings.
> >>> In settings.py
> >>> INSTALLED_APPS = (
> >>> 'social_auth',
> >>> }
> >>> TEMPLATE_CONTEXT_PROCESSORS = (
> >>>      "django.core.context_processors.auth",
> >>>      "django.core.context_processors.debug",
> >>>      "django.core.context_processors.i18n",
> >>>      "django.core.context_processors.media",
> >>>      "django.core.context_processors.static",
> >>>     "django.contrib.messages.context_processors.messages",
> >>>     "django.core.context_processors.request",
> >>>      social_auth.context_processors.social_auth_by_type_backends ,
> >>> )
> >>> AUTHENTICATION_BACKENDS = (
> >>>      'social_auth.backends.twitter.TwitterBackend',
> >>>     'django.contrib.auth.backends.ModelBackend',
> >>> )
> >>> SOCIAL_AUTH_ENABLED_BACKENDS = ('twitter')
> >>> TWITTER_CONSUMER_KEY         = '0hdgdhsnmzHDGDK'
> >>> TWITTER_CONSUMER_SECRET      = 'YyNngsgw[1jw lcllcleleedfejewjuw'
> >>> LOGIN_URL = '/accounts/login/' #login form for users to log in with
> >>> their username and password!
> >>> SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/homi/'  #page after user get
> >>> authenticated
> >>> SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = '/homi/'   '  #page after
> >>> user get authenticated
> >>> SOCIAL_AUTH_ERROR_KEY='social_errors'
> >>> SOCIAL_AUTH_COMPLETE_URL_NAME  = 'socialauth_complete'
> >>> SOCIAL_AUTH_ASSOCIATE_URL_NAME = 'socialauth_associate_complete'
> >>> from django.template.defaultfilters import slugify
> >>> SOCIAL_AUTH_USERNAME_FIXER = lambda u: slugify(u)
> >>> SOCIAL_AUTH_UUID_LENGTH = 16
> >>> SOCIAL_AUTH_EXTRA_DATA = False
> >>> In urls.py
> >>> url(r'', include('social_auth.urls')),
> >>> In my template:
> >>> 
> >>>    Enter using Twitter >>> a>
> >>>    
> >>> 
> >>> What do you think I m doing wrong? Hope to hear from you soon. Thanks
> >>> so much!
> >>> N:B : I m coding on windows machine. And in the development
> >>> environment using localhost:8000.

-- 
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: south create_table doesn't work

2012-02-03 Thread Anoop Thomas Mathew
Hi,

May be you are asking at the wrong place. Please check it in south mailing
list history, you should be able to find an answer.
http://groups.google.com/group/south-users/search?group=south-users&q=create_table&qt_g=Search+this+group

Thanks,
Anoop
atm
___
Life is short, Live it hard.




On 3 February 2012 13:19, Alessandro Candini  wrote:

> Nobody who has experience with south?
>
> On Feb 2, 5:14 pm, Alessandro Candini  wrote:
> > I'm trying to use django-south-0.7.3 API's to create a table, following
> > this:http://south.aeracode.org/docs/databaseapi.html#accessing-the-api
> >
> > This is my code:
> > from south.db import dbs
> > dbs['lc'].create_table('test', [
> >  ('id', models.AutoField(primary_key=True)),
> >  ('name', models.CharField(max_length=255)),
> >  ])
> >
> > The problem is that I do not get any error, but in the lc database, no
> > table appears.
> > Where is the issue?
> >
> > Thanks in advance
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-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.