Re: FYI: Scheduled downtime on djangoproject.com Thursday night

2013-01-29 Thread kl4us
nice one, i'm new on django and i'm reading documentation all day 

Il giorno martedì 29 gennaio 2013 18:11:48 UTC+1, Jacob Kaplan-Moss ha 
scritto:
>
> Hey folks -- 
>
> MediaTemple, our hosting provider for djangoproject.com, is going to 
> be taking our server offline Thursday night while they give us more 
> RAM. 
>
> The window for downtime is some time between 9PM and 4AM, though the 
> actual downtime itself should be less than an hour. 
>
> Since most people use the site for documentation, I'll remind you that 
> you can always find a mirror of Django's documentation on Read the 
> Docs: http://django.readthedocs.org/. 
>
> Thanks! 
>
> Jacob 
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Question on django scrapy integration

2013-02-11 Thread kl4us
Hi all,
i have a question on scrapy -> django integration.

i have this models on django:

from django.db import models
from django.utils import timezone
import datetime
class Job(models.Model):
title = models.CharField(max_length=100)
description = models.TextField(max_length=500)
url = models.URLField()
pub_date = models.DateTimeField('date published')
rand_ord = models.FloatField(default=0)
def __unicode__(self):
return self.title
def was_published_recently(self):
return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
was_published_recently.admin_order_field = 'pub_date'
was_published_recently.boolean = True
was_published_recently.short_description = 'Published recently?'
class Attribute(models.Model):
description = models.CharField(max_length=50)
def __unicode__(self):
return self.description
class JobAttribute(models.Model):
attribute_id = models.ForeignKey(Attribute)
job_id = models.ForeignKey(Job)
value = models.CharField(max_length=50)


and i'm going to write the pipeline.

In scrapy i have items:

from scrapy.contrib.djangoitem import DjangoItem
from jobs.models import Job, JobAttribute, Attribute

class JobItem(DjangoItem):
django_model = Job

class JobAttributeItem(DjangoItem):
django_model = JobAttribute

class AttributeItem(DjangoItem):
django_model = Attribute


in my spider i have:

item = JobItem()
item["url"] = response.url
item["title"] = 'something'
item['pub_date'] = 'something'
item["description"] = 'something'
item.save()



Everythings work fine. But now i want to save JobAttributeItem too:

item_jobattribute = JobAttributeItem()
item_jobattribute['job_id'] = 'want a job object'
item_jobattribute['attribute_id'] = 'what a attribute object'
item_jobattribute['value'] = 'something'
item_jobattribute.save()


how can i do this?
Thanks a lot

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Question on django scrapy integration

2013-02-11 Thread kl4us
is possible to Poll.objects.get(pk=1) into scrapy?

Il giorno lunedì 11 febbraio 2013 14:48:51 UTC+1, kl4us ha scritto:
>
> Hi all,
> i have a question on scrapy -> django integration.
>
> i have this models on django:
>
> from django.db import models
> from django.utils import timezone
> import datetime
> class Job(models.Model):
> title = models.CharField(max_length=100)
> description = models.TextField(max_length=500)
> url = models.URLField()
> pub_date = models.DateTimeField('date published')
> rand_ord = models.FloatField(default=0)
> def __unicode__(self):
> return self.title
> def was_published_recently(self):
> return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
> was_published_recently.admin_order_field = 'pub_date'
> was_published_recently.boolean = True
> was_published_recently.short_description = 'Published recently?'
> class Attribute(models.Model):
> description = models.CharField(max_length=50)
> def __unicode__(self):
> return self.description
> class JobAttribute(models.Model):
> attribute_id = models.ForeignKey(Attribute)
> job_id = models.ForeignKey(Job)
> value = models.CharField(max_length=50)
>
>
> and i'm going to write the pipeline.
>
> In scrapy i have items:
>
> from scrapy.contrib.djangoitem import DjangoItem
> from jobs.models import Job, JobAttribute, Attribute
>
> class JobItem(DjangoItem):
> django_model = Job
>
> class JobAttributeItem(DjangoItem):
> django_model = JobAttribute
>
> class AttributeItem(DjangoItem):
> django_model = Attribute
>
>
> in my spider i have:
>
> item = JobItem()
> item["url"] = response.url
> item["title"] = 'something'
> item['pub_date'] = 'something'
> item["description"] = 'something'
> item.save()
>
>
>
> Everythings work fine. But now i want to save JobAttributeItem too:
>
> item_jobattribute = JobAttributeItem()
> item_jobattribute['job_id'] = 'want a job object'
> item_jobattribute['attribute_id'] = 'what a attribute object'
> item_jobattribute['value'] = 'something'
> item_jobattribute.save()
>
>
> how can i do this?
> Thanks a lot
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Problem with django 1.5.1

2013-05-09 Thread kl4us
I have this code http://pastebin.com/xTJTmZws
with django 1.4.3 on OSX works fine, on ubuntu with django 1.5.1 i have 
error "coercing to Unicode: need string or buffer, Post found" at line "{% 
url post slug=post.slug %}" of template post_list.html.

Why and how can i adjust this?

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Problem with django 1.5.1

2013-05-09 Thread kl4us
works, thanks a lot

Il giorno giovedì 9 maggio 2013 16:37:11 UTC+2, ejb ha scritto:
>
> Hey kl4us,
>
> I think the problem is that you need to specify the URL name as a string, 
> like: {% url 'post' slug=post.slug %}
>
> https://docs.djangoproject.com/en/dev/topics/http/urls/#naming-url-patterns
>
> Elliot
>
>
> On Thu, May 9, 2013 at 10:29 AM, kl4us  >wrote:
>
>> I have this code http://pastebin.com/xTJTmZws
>> with django 1.4.3 on OSX works fine, on ubuntu with django 1.5.1 i have 
>> error "coercing to Unicode: need string or buffer, Post found" at line 
>> "{% url post slug=post.slug %}" of template post_list.html.
>>
>> Why and how can i adjust this?
>>
>> -- 
>> 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?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




how to make project template?

2013-06-07 Thread kl4us
Anyone know how to push changes upstream back to the template after having 
started the project? i'm in this snenario:

1) I start a project from pinax:

$ virtualenv mysite
$ source mysite/bin/activate
(mysite)$ pip install Django==1.4.5
(mysite)$ django-admin.py startproject 
--template=https://github.com/pinax/pinax-project-social/zipball/master mysite
(mysite)$ cd mysite
(mysite)$ pip install -r requirements.txt
(mysite)$ python manage.py syncdb
(mysite)$ python manage.py runserver

2) make stuff 
3) i want to pull to pinax repository my changes

The question is: How can i change my named project "mysite" with {{ 
project_name}} back?


-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how to make project template?

2013-06-10 Thread kl4us
any suggestion please?

Il giorno venerdì 7 giugno 2013 19:13:50 UTC+2, kl4us ha scritto:
>
> Anyone know how to push changes upstream back to the template after 
> having started the project? i'm in this snenario:
>
> 1) I start a project from pinax:
>
> $ virtualenv mysite
> $ source mysite/bin/activate
> (mysite)$ pip install Django==1.4.5
> (mysite)$ django-admin.py startproject 
> --template=https://github.com/pinax/pinax-project-social/zipball/master mysite
> (mysite)$ cd mysite
> (mysite)$ pip install -r requirements.txt
> (mysite)$ python manage.py syncdb
> (mysite)$ python manage.py runserver
>
> 2) make stuff 
> 3) i want to pull to pinax repository my changes
>
> The question is: How can i change my named project "mysite" with {{ 
> project_name}} back?
>
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Django and soaplib xmlns problem

2013-09-09 Thread kl4us
Hi all,
I'm developing a soap service with django 1.5.2, python 2.7.3 and soaplib 
0.8.1. For now a simple method works fine but ... how i can add *xmlns* to 
response?

This is my view.py

from sms.soaplib_handler import DjangoSoapApp, soapmethod, soap_typesfrom 
django.views.decorators.csrf import csrf_exempt

class SmsGatewayService(DjangoSoapApp):

__tns__ = 'http://tempuri.org'

@soapmethod(
soap_types.String, 
soap_types.String, 
soap_types.String, 
soap_types.Integer,
soap_types.Boolean, 
soap_types.Boolean, 
soap_types.String, 
_returns=soap_types.Any
)
def sendSms(
self, 
sendTo, 
numSender,
senderDescription,
timeToLive,
isDelivered,
isStatistics,
messageText
):

retCode = 'OK'

return retCode

sms_gateway_service = csrf_exempt(SmsGatewayService())


This is my soaplib_handler.py

> from soaplib.wsgi_soap import SimpleWSGISoapApp
> from soaplib.service import soapmethod
> from soaplib.serializers import primitive as soap_types
> from django.http import HttpResponse
>
> class DjangoSoapApp(SimpleWSGISoapApp):
> def __call__(self, request):
> django_response = HttpResponse()
> def start_response(status, headers):
> status, reason = status.split(' ', 1)
> django_response.status_code = int(status)
> for header, value in headers:
> django_response[header] = value
> response = super(SimpleWSGISoapApp, self).__call__(request.META, 
> start_response)
> django_response.content = "\n".join(response)
> return django_response


and this is the response when i call the method:

http://schemas.xmlsoap.org/soap/envelope/";>
   
  
 
OK
 
  
   

How i can modify a soap response? I need to have something similar to:

http://schemas.xmlsoap.org/soap/envelope/";>
   
  http://tempuri.org";>
 OK
  
   

I'm newbie to soaplib and newbie++ to django and python.

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