Re: Connect django project with sharepoint 2013

2014-12-06 Thread Hossein Rashnoo
I can access to http://portal:8080/ in my browser when i set our office 
proxy and port. And my linux server that i run django on it, is local. Do i 
need to set proxy to access sharepoint?

On Sunday, December 7, 2014 8:30:18 AM UTC+3:30, somecallitblues wrote:
>
> Urllib2 can't open the url http:// portal:8080. I assume that you can't 
> visit that url from the browser either
> On 07/12/2014 3:46 pm, "Hossein Rashnoo" > 
> wrote:
>
>> I need this connection for adding list items and save my users data on 
>> sharepoint database. I ran it in command line and when i write something 
>> like """ print site.lists[0] """ this error appear :
>>
>>
>>   File "", line 1, in 
>>   File "/usr/lib/python2.6/site-packages/sharepoint/lists/__init__.py", 
>> line 84, in __getitem__
>> return self.all_lists[key]
>>   File "/usr/lib/python2.6/site-packages/sharepoint/lists/__init__.py", 
>> line 36, in all_lists
>> result = self.opener.post_soap(LIST_WEBSERVICE, xml)
>>   File "/usr/lib/python2.6/site-packages/sharepoint/site.py", line 31, in 
>> post_soap
>> response = self.opener.open(request)
>>   File "/usr/lib64/python2.6/urllib2.py", line 391, in open
>> response = self._open(req, data)
>>   File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
>> '_open', req)
>>   File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
>> result = func(*args)
>>   File "/usr/lib64/python2.6/urllib2.py", line 1190, in http_open
>> return self.do_open(httplib.HTTPConnection, req)
>>   File "/usr/lib64/python2.6/urllib2.py", line 1165, in do_open
>> raise URLError(err)
>> URLError: 
>>
>>
>> On Saturday, December 6, 2014 4:19:45 PM UTC+3:30, François Schiettecatte 
>> wrote:
>>>
>>> Ok, but I am not sure what this has to do with Django ? Maybe you should 
>>> ask on a SharePoint mailing list ? And did you try running the code in a 
>>> script on the command line ? 
>>>
>>> François 
>>>
>>> > On Dec 6, 2014, at 7:10 AM, Hossein Rashnoo  wrote: 
>>> > 
>>> > I need to connect my project to sharepoint. So i installed "sharepoint 
>>> 0.4.1" package and then use this code in my view : 
>>> > 
>>> > from sharepoint import SharePointSite, basic_auth_opener 
>>> > 
>>> > def userloginres(request): 
>>> > server_url = "http://portal:8080/"; 
>>> > site_url = server_url + "rashno/" 
>>> > opener = basic_auth_opener(server_url, "my username", "my 
>>> password") 
>>> > site = SharePointSite(site_url, opener) 
>>> > 
>>> > htt=r"Sharepoint lists" 
>>> > for sp_list in site.lists: 
>>> > htt = htt + r" %s . %s " % (sp_list.id
>>> ,sp_list.meta['Title']) 
>>> > htt = htt + r"" 
>>> > 
>>> > t = get_template('userlogin/userloginres.html') 
>>> > html= t.render(Context({"htt":htt})) 
>>> > return HttpResponse(html) 
>>> > 
>>> > But now when i open that url this error appear: 
>>> > 
>>> > URLError at /test/login/ 
>>> > 
>>> >  
>>> > 
>>> > -- 
>>> > You received this message because you are subscribed to the Google 
>>> Groups "Django users" group. 
>>> > To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com. 
>>> > To post to this group, send email to django...@googlegroups.com. 
>>> > Visit this group at http://groups.google.com/group/django-users. 
>>> > To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-users/a982dfcf-6824-441a-ab5f-f68907e1f0d7%
>>> 40googlegroups.com. 
>>> > For more options, visit https://groups.google.com/d/optout. 
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/34b04a5b-0a1e-4405-9a73-a8e3856940a2%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

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


Re: How to set choice limit of given number on ModelMultipleChoiceField in Django?

2014-12-06 Thread inoyon artlover KLANGRAUSCH
Hi Collin, yes exactly. It is as follows:
User can select a main coummunication language which is connected as 
ForeignKey to the main langauges table.
Withn the field below the user can select further languages but when I 
select english as main language,
this language shouldn't be available within the ManyToMany.. 

Am Samstag, 6. Dezember 2014 18:25:59 UTC+1 schrieb Collin Anderson:
>
> Hi,
>
> Are you saying you have a ForeignKey choice field on the same form (above 
> the ManyToMany), and when you change the choice field it should change the 
> available values in the ManyToMany?
>
> Collin
>
> On Thursday, December 4, 2014 7:20:13 PM UTC-5, inoyon artlover 
> KLANGRAUSCH wrote:
>>
>> Very cool! :) Many thanks, once more! :) Could be off-topic, but there is 
>> somethin more tricky:
>> Before a ManyToManyField there is one ForeignKeyField which has few of 
>> the same values. 
>> So the ForeignKey-value has to be excluded from the ManyToMany choices. 
>> For example 
>> the ForeignKey selection (labeld as: additional values) could trigger on 
>> submit a queryset and 
>> a view colud display the filterd ManyToManyField... (btw. I am very new 
>> to python/django so..
>> try'n error is the tedious way to go since two month... )
>>
>>
>> Am Freitag, 5. Dezember 2014 00:52:18 UTC+1 schrieb larry@gmail.com:
>>>
>>> On Thu, Dec 4, 2014 at 6:46 PM, inoyon artlover KLANGRAUSCH 
>>>  wrote: 
>>> > Great, it works with one form but not with an another... 
>>> > Btw. how is it possible to overwrite the 'this field is required' 
>>> error 
>>> > message? 
>>>
>>> You can provide your custom set of default errors to the form field 
>>> definition, e.g.: 
>>>
>>> my_default_errors = { 
>>> 'required': 'You better enter this field!', 
>>> 'invalid': 'You can do better than that!' 
>>> } 
>>>
>>> class MyForm(forms.Form): 
>>> some_field = forms.CharField(error_messages=my_default_errors) 
>>>
>>>
>>> > 
>>> > Many thanks and best regards! :) 
>>> > 
>>> > Am Donnerstag, 4. Dezember 2014 23:01:15 UTC+1 schrieb 
>>> larry@gmail.com: 
>>> >> 
>>> >> On Thu, Dec 4, 2014 at 4:54 PM, inoyon artlover KLANGRAUSCH 
>>> >>  wrote: 
>>> >> > Hi there, I got a following Form-Class: 
>>> >> > 
>>> >> > 
>>> >> > class CustomUserprofileInterestsForm(forms.ModelForm): 
>>> >> > 
>>> >> > interests = forms.ModelMultipleChoiceField( 
>>> >> > queryset=Interests.objects.all(), 
>>> >> > widget=forms.CheckboxSelectMultiple) 
>>> >> > 
>>> >> > 
>>> >> > I want to limit the choices for example to 6 of all displayed. 
>>> >> > Is it possible with some optional arguments I don't know somehow? 
>>> >> > 
>>> >> 
>>> >> You can write your own clean method on the form, e.g.: 
>>> >> 
>>> >> def clean_interests(self): 
>>> >> value = self.cleaned_data['interests'] 
>>> >> if len(value) > 6: 
>>> >> raise forms.ValidationError("You can't select more than 6 
>>> items.") 
>>> >> return value 
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c255a393-d8a4-477c-85d8-14132bde2c74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Connect django project with sharepoint 2013

2014-12-06 Thread Mario Gudelj
Urllib2 can't open the url http:// portal:8080. I assume that you can't
visit that url from the browser either
On 07/12/2014 3:46 pm, "Hossein Rashnoo"  wrote:

> I need this connection for adding list items and save my users data on
> sharepoint database. I ran it in command line and when i write something
> like """ print site.lists[0] """ this error appear :
>
>
>   File "", line 1, in 
>   File "/usr/lib/python2.6/site-packages/sharepoint/lists/__init__.py",
> line 84, in __getitem__
> return self.all_lists[key]
>   File "/usr/lib/python2.6/site-packages/sharepoint/lists/__init__.py",
> line 36, in all_lists
> result = self.opener.post_soap(LIST_WEBSERVICE, xml)
>   File "/usr/lib/python2.6/site-packages/sharepoint/site.py", line 31, in
> post_soap
> response = self.opener.open(request)
>   File "/usr/lib64/python2.6/urllib2.py", line 391, in open
> response = self._open(req, data)
>   File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
> '_open', req)
>   File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
> result = func(*args)
>   File "/usr/lib64/python2.6/urllib2.py", line 1190, in http_open
> return self.do_open(httplib.HTTPConnection, req)
>   File "/usr/lib64/python2.6/urllib2.py", line 1165, in do_open
> raise URLError(err)
> URLError: 
>
>
> On Saturday, December 6, 2014 4:19:45 PM UTC+3:30, François Schiettecatte
> wrote:
>>
>> Ok, but I am not sure what this has to do with Django ? Maybe you should
>> ask on a SharePoint mailing list ? And did you try running the code in a
>> script on the command line ?
>>
>> François
>>
>> > On Dec 6, 2014, at 7:10 AM, Hossein Rashnoo  wrote:
>> >
>> > I need to connect my project to sharepoint. So i installed "sharepoint
>> 0.4.1" package and then use this code in my view :
>> >
>> > from sharepoint import SharePointSite, basic_auth_opener
>> >
>> > def userloginres(request):
>> > server_url = "http://portal:8080/";
>> > site_url = server_url + "rashno/"
>> > opener = basic_auth_opener(server_url, "my username", "my
>> password")
>> > site = SharePointSite(site_url, opener)
>> >
>> > htt=r"Sharepoint lists"
>> > for sp_list in site.lists:
>> > htt = htt + r" %s . %s " % (sp_list.id
>> ,sp_list.meta['Title'])
>> > htt = htt + r""
>> >
>> > t = get_template('userlogin/userloginres.html')
>> > html= t.render(Context({"htt":htt}))
>> > return HttpResponse(html)
>> >
>> > But now when i open that url this error appear:
>> >
>> > URLError at /test/login/
>> >
>> > 
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "Django users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to django-users...@googlegroups.com.
>> > To post to this group, send email to django...@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/django-users.
>> > To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/a982dfcf-6824-441a-ab5f-f68907e1f0d7%
>> 40googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/34b04a5b-0a1e-4405-9a73-a8e3856940a2%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHqTbj%3D5nfwvwi9AzXU62fOh%2B4P05GH6L19XULrezs_reVT4gg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Connect django project with sharepoint 2013

2014-12-06 Thread Hossein Rashnoo
I need this connection for adding list items and save my users data on 
sharepoint database. I ran it in command line and when i write something 
like """ print site.lists[0] """ this error appear :


  File "", line 1, in 
  File "/usr/lib/python2.6/site-packages/sharepoint/lists/__init__.py", 
line 84, in __getitem__
return self.all_lists[key]
  File "/usr/lib/python2.6/site-packages/sharepoint/lists/__init__.py", 
line 36, in all_lists
result = self.opener.post_soap(LIST_WEBSERVICE, xml)
  File "/usr/lib/python2.6/site-packages/sharepoint/site.py", line 31, in 
post_soap
response = self.opener.open(request)
  File "/usr/lib64/python2.6/urllib2.py", line 391, in open
response = self._open(req, data)
  File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
'_open', req)
  File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
  File "/usr/lib64/python2.6/urllib2.py", line 1190, in http_open
return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib64/python2.6/urllib2.py", line 1165, in do_open
raise URLError(err)
URLError: 


On Saturday, December 6, 2014 4:19:45 PM UTC+3:30, François Schiettecatte 
wrote:
>
> Ok, but I am not sure what this has to do with Django ? Maybe you should 
> ask on a SharePoint mailing list ? And did you try running the code in a 
> script on the command line ? 
>
> François 
>
> > On Dec 6, 2014, at 7:10 AM, Hossein Rashnoo  > wrote: 
> > 
> > I need to connect my project to sharepoint. So i installed "sharepoint 
> 0.4.1" package and then use this code in my view : 
> > 
> > from sharepoint import SharePointSite, basic_auth_opener 
> > 
> > def userloginres(request): 
> > server_url = "http://portal:8080/"; 
> > site_url = server_url + "rashno/" 
> > opener = basic_auth_opener(server_url, "my username", "my 
> password") 
> > site = SharePointSite(site_url, opener) 
> > 
> > htt=r"Sharepoint lists" 
> > for sp_list in site.lists: 
> > htt = htt + r" %s . %s " % 
> > (sp_list.id,sp_list.meta['Title']) 
>
> > htt = htt + r"" 
> > 
> > t = get_template('userlogin/userloginres.html') 
> > html= t.render(Context({"htt":htt})) 
> > return HttpResponse(html) 
> > 
> > But now when i open that url this error appear: 
> > 
> > URLError at /test/login/ 
> > 
> >  
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Django users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to django-users...@googlegroups.com . 
> > To post to this group, send email to django...@googlegroups.com 
> . 
> > Visit this group at http://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/a982dfcf-6824-441a-ab5f-f68907e1f0d7%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/34b04a5b-0a1e-4405-9a73-a8e3856940a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[OFFTOPIC] Import Python Weekly Newsletter

2014-12-06 Thread Ankur Gupta
Hi Guys,

Want to draw your attention to http://importpython.com a weekly python 
newsletter. Newsletter also features Django Articles, Projects on regular 
basis. Also have a look at http://importpython.com/books/ which list 53 
free Python Books.

Regards,
Ankur

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/55be55c5-eb50-4ee3-8e59-0cf74434de21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: another CSRF question -- and django hitcount

2014-12-06 Thread Eric Abrahamsen
Eric Abrahamsen  writes:

Apologies for the very stupid posting below! I did my homework, and
actually used the JQuery ajax function, like I was supposed to.

Incidentally, I also had the "async" keyword on the  tag in the
head that loaded jquery, and that apparently killed the document.ready
function altogether. Learned something new.

> I have a question about the django-hitcount app that I think is likely
> csrf-related.
>
> I recently upgraded a site from Django 1.4 all the way to 1.7. I've got
> most everything working fine, except that the hitcount app I've been
> using[1], stopped recording hits.
>
> Nevermind the actual app, it works by making an ajax call to a certain
> URL when a page is opened. Right now, the rendered javascript looks like
> this:
>
>