Re: Django site as SOAP endpoint

2021-01-31 Thread Xavier Ordoquy

Hi Fenrir,

You may give Spyne (http://spyne.io/) a try.
It is a RPC framework that can handle SOAP requests and has a Django 
integration.
Spyne has a couple of drawbacks - IMHO it tries to do too any things and 
may be somewhat complex - but it does the job.

Hopes this will help,
Xavier O.
Le dimanche 31 janvier 2021 à 08:45:51 UTC+1, fenrir...@gmail.com a écrit :

> I’m working on a project where one of the remote parties requires us to 
> serve a SOAP api. I have plenty experience with DRF, but only found soap 
> client examples (using The ’zeep’ module: zeep==soap in Dutch)  which I use 
> to call the SOAP api from the other party . There is django-soap-server but 
> the latest version is 10y old)
>
> Does anyone have experience with django as soap endpoint recently?
>
>
>
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e67f9700-d881-454d-8c8f-897362331cd2n%40googlegroups.com.


Re: Django rest framework Version

2018-01-08 Thread Xavier Ordoquy
Hi,

Out of curiosity, is there anything wrong with the latest version ?

Regards,
Xavier.

> Le 9 janv. 2018 à 04:59, Rakhee Menon  a écrit :
> 
> Hey!!!
> Please can anyone tell whats the stable version of django rest framework to 
> be used for production.
> Thanks in Advance.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to django-users@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/1d4378ba-c467-4712-b4c6-fdd8003e9a83%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8C4C1D81-74C9-4384-8744-AE1A372C1853%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django REST framework nested query.

2017-11-06 Thread Xavier Ordoquy
Hi,

You are looking for nested serializers. Documentation explains how to deal with 
them at: 
http://www.django-rest-framework.org/api-guide/relations/#nested-relationships 


Regards,
Xavier,
Linovia.


> Le 7 nov. 2017 à 04:30, Shamim Hossain  a écrit :
> 
>  I am switched to Djangorest framework from Nodejs. I don't know how can I 
> start to solve following problem.
> 
> I have two django model named Category and Product. In Category model has 
> "is_featured" boolean field. 
> I need category list in JSON format where is_featured=true and the list of 
> products. The models are like following.
> 
> from django.db import models
> 
> class Category(models.Model):
> name=models.CharField(max_length=25, blank=False, null=False)
> is_featured=models.BooleanField(default=False)
> parent=models.ForeignKey('self', on_delete=models.CASCADE)
> 
> def __str__(self):
> return self.name
> 
> class Product(models.Model):
> name=models.CharField(max_length=25, blank=False, null=False)
> category=models.ForeignKey(Category, on_delete=models.CASCADE)
> uom=models.CharField(max_length=10)
> price=models.FloatField()
> 
> def __str__(self):
> return '%s %s %s %s' % (self.name, self.category.name, 
> self.price, self.uom)
> My expected category list (is_featured=true) result will be look like 
> following.
> 
> {  
>   "id":1,
>   "name":"Foods",
>   "products":[  
>  {  
> "id":2,
> "name":"Chicken Fri",
> "price":80
>  },
>  {  
> "id":4,
> "name":"Tomato Salad",
> "price":20
>  }
>   ]
> },
> {  
>   "id":3,
>   "name":"Vegitable",
>   "products":[  
>  {  
> "id":3,
> "name":"Potato",
> "price":20
>  },
>  {  
> "id":6,
> "name":"Bean",
> "price":55
>  }
>   ]
> }
> 
> -- 
> 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 https://groups.google.com/group/django-users 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/207046d9-00fd-4919-a0b0-8a13e4922e6e%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/41352EFE-499C-42F2-BDE3-368742038186%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


Re: Updating data via admin not visible on restful api without admin specified in url until restart server

2017-09-26 Thread Xavier Ordoquy
Hi,

You likely have an issue with scope in your code. Something similar to 
https://stackoverflow.com/questions/15395521/django-form-field-will-not-update-without-server-reset-instantiating-a-clas
 

 for example.

Regards,


> Le 26 sept. 2017 à 21:42, cnn.market...@gmail.com a écrit :
> 
> 
> After login to my account via http://127.0.0.1:8000/admin, I update the data 
> in field 'name' for 'demo'. I can see the updated data for 'name' by using 
> http://127.0.0.1:8000/admin/demo. However, the field 'name' is showing the 
> old data via url (restful api) http://127.0.0.1:8000/demo (NOTICE, no 'admin' 
> in the url) until I manually restart the server via 'python manage.py 
> runserver'.
> 
> Is this a known issue?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to django-users@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/75a7bc85-5520-4ff9-a846-fde426b72927%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/FE0B581F-DA2D-48F5-BFEE-C8636AA744B6%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to write APIview to access a specific item by using APIViews only

2017-09-06 Thread Xavier Ordoquy

> Le 6 sept. 2017 à 10:00, Melvyn Sopacua  a écrit :
> 
> One of the core design issues with DRF is that everything
> is based around a queryset. Even if the set is just one item.

This sounds like an easy troll.
A lot of code from DRF is based around queryset because DRF can introspect and 
deduce a lot from them.
How is DRF supposed to perform filtering on something that we don’t know (aka 
not based on a Model) ?
Same question for automatic field generation, constraints, pagination and so on.

One thing people need to realize is that:
1. It’s simple to use DRF with non model data, including viewsets - as opposed 
as what I’ve read on this thread.
2. developer has to write way more code because the framework can *not* guess 
anything from it
3. A lot of code and documentation covers things based on models because models 
embedded data description in a structured way while we can’t say much about non 
model things.

Regards,
Xavier.

> Django makes a clear distinction throughout, from model to
> view and doesn't combine list and detail views based on the
> absence or presence of an identifier.
> 
> 
> On Wed, Sep 6, 2017 at 9:06 AM, Rakhee Menon  wrote:
>> 
>> 
>> Thanks a lot James :-)
>> 
>> --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/c13da61b-eebc-49e3-a85a-88482541c1d8%40googlegroups.com.
>> 
>> For more options, visit https://groups.google.com/d/optout.
> 
> 
> 
> -- 
> Melvyn Sopacua
> 
> -- 
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CA%2Bgw1GUuk3kLZ90w5HX9jxVQQJD%3DnEMRh%3DoozcP-BcQPH74P0w%40mail.gmail.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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4232FEBF-EF70-4D4B-842D-32DB346D9F7B%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django rest framework cannot deal with multple objects in model viewset

2017-04-20 Thread Xavier Ordoquy

> Le 21 avr. 2017 à 04:17, Robin Lery <robinl...@gmail.com> a écrit :
> 
> I have a very simple model and its related serializer and views:
> 
> class Page(models.Model):
> user = models.ForeignKey(User)
> title = models.CharField(max_length=255)
> pub_date = models.DateTimeField(default=timezone.now)
> 
> class PageSerializer(serializers.ModelSerializer):
> class Meta:
> model = Page
> fields = ('user', 'title', 'pub_date')
> 
> class PageViewSet(viewsets.ModelViewSet):
> queryset = Page.objects.all()
> serializer_class = PageSerializer
> Now I can post like this:
> 
> {
> "user": 1,
> "title": "Lorem ipsum"
> }
> This works fine. But I would like to post multiple objects like this:
> 
> [
> {
> "user": 1,
> "title": "Lorem ipsum one"
> },
> {
> "user": 1,
> "title": "Lorem ipsum two"
> }
> ]
> But this gives me an error:
> 
> "non_field_errors": [
> 
> "Invalid data. Expected a dictionary, but got list."
> ]
> So to accept multple objects I modified the view as per the doc:
> 
> class PageViewSet(viewsets.ModelViewSet):
> queryset = Page.objects.all()
> serializer_class = PageSerializer(queryset, many=True)
> 
> But I am getting an error:
> 
> TypeError at /api/blog/pages/
> 
> 'ListSerializer' object is not callable
> What am I missing here?

it’s serializer_class, not serializer_instance. You can’t instantiate the 
serializer there.
In order to deal with multiples items, you better override the `list` method to 
handle multiple objects creation and have an explicit serializer instantiation.

Regards,
Xavier Ordoquy,
Linovia.


-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/645FD5F7-649C-4454-9450-93AD87B6FA5C%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


Re: Flattening model relationships (in APIs)

2017-02-27 Thread Xavier Ordoquy
Quick question. How will you handle the fields updates ?
Like, what if you get an city_name="Bombay" and city_code="DEL" ?

If you can set them as read-only, then using the source argument is the way 
to go.
Alternatively, you can define a non model serializer and flatten the data 
before hand.
You can also decide to drop the serializers and pass a Python structure 
directly though you would have some work for the validation.

The more strict RESTfull way would be to use the several entry points and 
use hyperlinks on them (though it would add some extra requests).

You have a couple of options opened to you.
Remember that Django REST framework is no silver bullet.
You should think about how you want to represent your resources first and 
then write the associated code.
Also remember that easy isn't the same as simple. The framework targets the 
latter.

Regards,
Xavier.

Le mardi 21 février 2017 20:13:25 UTC+1, Ankush Thakur a écrit :
>
> I'm using DRF for an API. My problem is that I defined my postal address 
> like this (breaking it up into City, State, Country):
>
> class Country(models.Model):
> class Meta:
> db_table = 'countries'
>
> name = models.TextField()
> code = models.TextField(unique=True)
>
> class State(models.Model):
> class Meta:
> db_table = 'states'
>
> name = models.TextField()
> code = models.TextField(unique=True)
> country = models.ForeignKey('Country', on_delete=models.CASCADE)
>
>
> class City(models.Model):
> class Meta:
> db_table = 'cities'
>
> name = models.TextField()
> code = models.TextField(unique=True)
> state = models.ForeignKey('State', on_delete=models.CASCADE)
>
> class Address(models.Model):
> class Meta:
> db_table = 'addresses'
> 
> building_no = models.TextField()
> street = models.TextField(null=True)
> locality = models.TextField(null=True)
> landmark = models.TextField(null=True)
> pincode = models.TextField(null=True)
> latitude = models.DecimalField(max_digits=9, decimal_places=6, 
> null=True)
> longitude = models.DecimalField(max_digits=9, decimal_places=6, 
> null=True)
> city = models.ForeignKey('City', on_delete=models.CASCADE)
>
> Now, in my system, a venue has an address, and so the serializes are 
> defined like this:
>
> class VenueSerializer(serializers.ModelSerializer):
> address = AddressSerializer()
> offerings = OfferingSerializer(many=True)
>
> class Meta:
> model = Venue
> fields = ['id', 'name', 'price_per_day', 'status', 'offerings', 
> 'address', 'photos']
>
> which leads us to:
>
> class AddressSerializer(serializers.ModelSerializer):
> city = CitySerializer()
>
> class Meta:
> model = Address
> fields = ['id', 'building_no', 'street', 'locality', 'landmark', 
> 'pincode', 'latitude', 'longitude', 'city']
>
> which leads us to:
>
> class CitySerializer(serializers.ModelSerializer):
> state = StateSerializer()
>
> class Meta:
> model = City
> fields = ['id', 'name', 'code', 'state']
>
> which leads us to:
>
> class StateSerializer(serializers.ModelSerializer):
> country = CountrySerializer()
>
> class Meta:
> model = State
> fields = ['id', 'name', 'code', 'country']
>
> which finally leads to:
>
> class CountrySerializer(serializers.ModelSerializer):
> class Meta:
> model = Country
> fields = ['id', 'name', 'code']
>
> and when this gets serialized, the address is given in the following 
> format:
>
>  "address": {
>   "id": 2,
>   "building_no": "11",
>   "street": "Another Street",
>   "locality": "",
>   "landmark": "Fortis Hospital",
>   "pincode": "201003",
>   "latitude": "28.632778",
>   "longitude": "77.219722",
>   "city": {
> "id": 1,
> "name": "Delhi",
> "code": "DEL",
> "state": {
>   "id": 1,
>   "name": "Delhi",
>   "code": "DEL",
>   "country": {
> "id": 1,
> "name": "India",
> "code": "IN"
>   }
> }
>   }
> }
>
> So there's a hell lot of nesting from city to state to country. If the 
> relationship chain was even deeper, there would be even more nesting, which 
> I feel isn't great for API consumers. What is the best practice here to put 
> state and country at the same level as the city? I think this will also 
> complicate the logic while POSTing data, so I'm interested in knowing about 
> that as well.
>
> I'm sorry if there is too much code, but I couldn't think of a better way 
> to convey the situation than actually post everything.
>
>
> Regards,
> Ankush Thakur
>

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

Re: Non Ascii character in upload file crash in python 3

2016-06-08 Thread Xavier Ordoquy
Hi,

Le mercredi 8 juin 2016 10:13:46 UTC+2, luisza14 a écrit :
>
> I am using supervisor and gunicorn for production run as fondomutual user.
>
> $ env | grep LANG
> LANG=es_CR.UTF-8
> LANGUAGE=es_CR:es
>

Supervisor doesn't propagate the locales to its supervised processes. You 
need to set them explicitly in process configuration file.

Regards,
Xavier,
Linovia.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9cd0eb3f-c26e-42c6-b74a-2fd69594d5ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Right place to decrypt/decode data from DB before passing it to UI without affect data in DB itself.

2016-02-08 Thread Xavier Ordoquy
Hi,

> Le 8 févr. 2016 à 19:00, learn django  > a écrit :
> 
> Hi,
> 
> I store some data like email text, headers and from email address in encoded 
> format in the database.
> I want to have a  page where I can display all this information in readonly 
> format.
> 
> What is the ideal place & way to decode this information and pass it to 
> django UI.
> 
> I was thinking of reading all the information in my views.py.
> But then I don't want to affect my DB. aka information in DB should remain 
> encoded.
> 
> eg.
> 
> class FooViewSet(viewsets.ModelViewSet):
> queryset = Message.objects.all()
> 
> Message object has headers, body and from fields which are encoded before 
> storing in db.
> If I perform any operation on queryset those changes will be reflected in DB 
> so I cannot do that.
> 
> If I do something like below then I get exception for using list as queryset 
> becomes a list object instead of queryset object.
> 
> class FooViewSet(viewsets.ModelViewSet):
> queryset = list(Message.objects.all())
> for obj in queryset:
> body = base64.b64decode(obj.body)
> obj.body = body

This wil not work for different reasons.
First one is about Python scope. Doing this will get you a fixed list of 
Message unless you restart the server.
Second is you’re using a generic view that expects QuerySet as you’ve noticed. 
Overriding get_queryset would get somewhat bette result but it still wouldn’t 
work as QuerySet are expected for pagination and filtering.

The best place to perform that are to_representation and to_internal_value for 
that field.
You should have a look at the custom fields 
(http://www.django-rest-framework.org/api-guide/fields/#custom-fields 
) for 
guidance about how to handle that.

Regards,
Xavier,
Linovia.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/74175DA3-19EE-4D91-BC16-16374DFA2D45%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best approach to write unit tests involving rest apis.

2015-12-03 Thread Xavier Ordoquy

> Le 3 déc. 2015 à 08:08, learn django <siddhesh.dive...@gmail.com 
> <mailto:siddhesh.dive...@gmail.com>> a écrit :
> 
>  On Wednesday, December 2, 2015 at 10:48:52 PM UTC-8, Xavier Ordoquy wrote:
> Hi, 
> 
> > Le 3 déc. 2015 à 00:12, learn django <siddhesh...@gmail.com > 
> > a écrit : 
> > 
> > My app uses rest framework. 
> > I am writing test cases which involve standard requests like 
> > GET/POST/DELETE/PUT. 
> > What is the best approach to write the test cases ? 
> 
> Django REST framework comes with a test client named APIClient. 
> It will go through the middleware and urls before calling your API entry 
> points which seems to be what you’re looking for. 
> The documentation about it is available at 
> http://www.django-rest-framework.org/api-guide/testing/#apiclient 
> <http://www.django-rest-framework.org/api-guide/testing/#apiclient> 
> 
> 
> Hi Linovia,
> 
> Yes, I started with that.
> Initially I was getting 403 (auth failure) since my backend handlers have 
> @login_required decorator.

This may be an issue since a Django REST framework view shouldn’t use this 
decorator.
If it is a regular Django view that returns a JSON response, then you should 
consider using the Django client directly.

> To overcome that i created a super user (python manage.py superuser) &
> used those credentials as below.
> 
> # url = '/orca/api/v2/customer/'
> # data = {'c_name':'Pnc', 'c_role':'API-Admin'}
> # client = APIClient()
> # client.login(username='admin', password='admin')
> # response = client.post(url, data, format='json') 
> 
> After this I started was getting 302 (redirects).
> Have you encountered similar issue before ?

Where does it redirects you to ? If it’s the login page, it means that somehow 
the login call didn’t work.

Regards,
Xavier,
Linovia.

-- 
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/1E2EC51D-42E8-4654-8ABE-57D5F5479128%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best approach to write unit tests involving rest apis.

2015-12-02 Thread Xavier Ordoquy
Hi,

> Le 3 déc. 2015 à 00:12, learn django  a écrit :
> 
> My app uses rest framework.
> I am writing test cases which involve standard requests like 
> GET/POST/DELETE/PUT.
> What is the best approach to write the test cases ?

Django REST framework comes with a test client named APIClient.
It will go through the middleware and urls before calling your API entry points 
which seems to be what you’re looking for.
The documentation about it is available at 
http://www.django-rest-framework.org/api-guide/testing/#apiclient

Regards,
Xavier,
Linovia.

-- 
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/C9F5286E-8261-47C3-8F0C-959EBF267E49%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Django-Restframework adding and accessing a user to a model / adding an owner?

2015-11-07 Thread Xavier Ordoquy
Hi

> Le 7 nov. 2015 à 22:00, lnzy3...@gmx.de a écrit :
> 
>  
> It runs into an error. To me it seems like I cannot combine two models. My 
> goal is to access all the tasks attached to that user, or to add a task to 
> the user accessing the API at the moment
> So it would be very helpful, when someone could explains me the two issues:
> 1) How can I access the User information in a model? 

Depending on what you want to achieve, you can:
- use authentication, set the UserTask model to Task and override the view’s 
get_queryset to filter against the authenticated user (explained in the 
documentation at 
http://www.django-rest-framework.org/api-guide/filtering/#filtering-against-the-current-user)
- set the UserTask model to Task and filter the task list against a user 
(http://www.django-rest-framework.org/api-guide/filtering/#filtering-against-query-parameters)

> 2) How can I add data and attach that to a model.

You code snippet is correct except for the model attached to the view.

Regards,
Xavier,
Linovia.

-- 
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/6C0670E8-4F53-4A40-9020-66D7B291F1B1%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to develop a frontend web app for using REST services

2015-10-19 Thread Xavier Ordoquy
There isn't much to say.
ViewSet exposes the CRUD part, while serializer maps an object to native 
Python types.

Regards,
Xavier,
Linovia.

On Saturday, October 17, 2015 at 4:28:33 PM UTC+2, krmane wrote:
>
> Hi again,
> Xavier, I have gone through the main DRF documentation and also seen your 
> blog.
> I am wondering if you can send me an off line email which can explain the 
> relation between serializer and viewset?
> I have not got the concept clear, I am beginner to REST and all I 
> understand is that the response is generally in form of json.
> happy hacking.
> Krishnakant.
>
>
> On Friday 16 October 2015 03:39 PM, Xavier Ordoquy wrote:
>
> Hi, 
>
> I wrote a short blog post about getting most of Django REST framework 
> without using Django models.
>
> https://medium.com/@linovia/django-rest-framework-viewset-when-you-don-t-have-a-model-335a0490ba6f
>
> You will loose the integration with the Django Models and will need to do 
> a few things by yourself (pagination for example) but it’s still perfectly 
> possible to do that.
> Note that most of the documentation covers Django Models because it’s 
> where most of the options are. When you don’t use them, it’s up to the 
> developers to provide the content which will be very different from a 
> project to another.
>
> Hope this will help,
>
> Regards,
> Xavier,
> Linovia.
>
>
> Le 16 oct. 2015 à 12:00, kk < krm...@gmail.com > 
> a écrit :
>
> hello again,
> I haven't got my doubts solved but a few got added.
> I was again going through the tutorial on Django REST framework.
> I am trying to know if I can use a serialiser without tying it to the 
> DJango ORM or for that matter without tying it to any thing?
> I prefer using SQLAlchemy and get the data out using sql expression 
> language.
> Then I would like to convert this data to json format for sending as 
> response.
> Is this possible?
> Happy hacking.
> Krishnakant
>
>
> On Friday 16 October 2015 11:39 AM, kk wrote:
>
> Dear all.
> I got some very important suggestions from members of this list on using 
> Django for an accounting and inventory system, including Point of Sale.
> After the POS topic was discussed,
> OUr team decided to write a RESTfull server with all the business logic in 
> API.
> We plan to do this using some thing like Flask micro framework and then 
> write a complete web app using Django to consume these services.
> Of course it could be argued that why not use Django REST framework?
> But here I am a bit surprised as well as a bit disappointed.
> Contrary to what we have all seen and experienced about Django's 
> documentation, the rest framework is not at all comprehensively documented.
> I am still not totally understood the use of 
>
> serializers.HyperlinkedModelSerializer.
>  viewset is also not totally explained properly.  the tutorial is pretty fast 
> and confusing.
> I think a better example would have served it more understandable.
> Or perhaps the documentation there asumed that every one who reads it is a 
> Django as well as REST expert, even then it is confusing.
> Any ways coming back to the topic.
> So What suggestions could I get about my main query?
> happy hacking.
> Krishnakant.
>
>
>
> -- 
> 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/5620CACC.2060702%40gmail.com?utm_medium=email_source=footer>
> https://groups.google.com/d/msgid/django-users/5620CACC.2060702%40gmail.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/9872C498-CD0B-44A3-B64E-62A34F312C02%40linovia.com?utm_medium=email_source=footer>
> https://groups.google.com/d/msgid/django-users/9872C498-CD0B-44A3-B64E-62A34F312C02%40linovia.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message b

Re: How to develop a frontend web app for using REST services

2015-10-16 Thread Xavier Ordoquy
Hi,

I wrote a short blog post about getting most of Django REST framework without 
using Django models.
https://medium.com/@linovia/django-rest-framework-viewset-when-you-don-t-have-a-model-335a0490ba6f

You will loose the integration with the Django Models and will need to do a few 
things by yourself (pagination for example) but it’s still perfectly possible 
to do that.
Note that most of the documentation covers Django Models because it’s where 
most of the options are. When you don’t use them, it’s up to the developers to 
provide the content which will be very different from a project to another.

Hope this will help,

Regards,
Xavier,
Linovia.


> Le 16 oct. 2015 à 12:00, kk  a écrit :
> 
> hello again,
> I haven't got my doubts solved but a few got added.
> I was again going through the tutorial on Django REST framework.
> I am trying to know if I can use a serialiser without tying it to the DJango 
> ORM or for that matter without tying it to any thing?
> I prefer using SQLAlchemy and get the data out using sql expression language.
> Then I would like to convert this data to json format for sending as response.
> Is this possible?
> Happy hacking.
> Krishnakant
> 
> 
> On Friday 16 October 2015 11:39 AM, kk wrote:
>> Dear all.
>> I got some very important suggestions from members of this list on using 
>> Django for an accounting and inventory system, including Point of Sale.
>> After the POS topic was discussed,
>> OUr team decided to write a RESTfull server with all the business logic in 
>> API.
>> We plan to do this using some thing like Flask micro framework and then 
>> write a complete web app using Django to consume these services.
>> Of course it could be argued that why not use Django REST framework?
>> But here I am a bit surprised as well as a bit disappointed.
>> Contrary to what we have all seen and experienced about Django's 
>> documentation, the rest framework is not at all comprehensively documented.
>> I am still not totally understood the use of 
>> serializers.HyperlinkedModelSerializer.
>>  viewset is also not totally explained properly.  the tutorial is pretty 
>> fast and confusing.
>> I think a better example would have served it more understandable.
>> Or perhaps the documentation there asumed that every one who reads it is a 
>> Django as well as REST expert, even then it is confusing.
>> Any ways coming back to the topic.
>> So What suggestions could I get about my main query?
>> happy hacking.
>> Krishnakant.
> 
> 
> -- 
> 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/5620CACC.2060702%40gmail.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/9872C498-CD0B-44A3-B64E-62A34F312C02%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


Re: [REQUEST] Please list all the deprecations in the changelogs.

2015-10-12 Thread Xavier Ordoquy
Hi Vasiliy,

> Le 12 oct. 2015 à 14:53, Vasiliy Korol  a écrit :
> 
> Hi.
> I find it useful to turn DeprecationWarnings into exeptions on the 
> development server in order to ease the future transition to the next Django 
> LTS release.
> After migrating to Django 1.8.5, we received some unexpected exceptions on 
> the devel server, related to the recently deprecated features (like the 
> 'context_instance' kwarg in render_to_response() ).
> Could the developers please mention ALL the new deprecations in the changelog 
> for every minor version release? It would be very convenient to know about 
> these before upgrading.

Isn’t it mentioned  here:
https://docs.djangoproject.com/en/1.8/releases/1.8/#dictionary-and-context-instance-arguments-of-rendering-functions
 ?

It says it’s removed in 1.10 which translates into a DeprecationWarning in 1.8

Regards,
Xavier,
Linovia.

-- 
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/9C687207-F2F4-446D-B84D-AA9202B6A363%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


Re: DRF without login

2015-08-13 Thread Xavier Ordoquy

> Le 13 août 2015 à 23:06, Prabath Peiris  a écrit :
> 
> Hi 

Hi

> I am trying to implement a DRF in existing django project. I installed the 
> drf and set up APiView (class based) and add the get() to the class. When I 
> call this get method I get an error  as "Exception Value: no such table: 
> auth_user" and also create a db.sqlite3 database. how can I just simply have 
> a api (without models or without any authentications)

You probably want to turn off the DRF authentication / permissions system 
(http://www.django-rest-framework.org/api-guide/authentication/#setting-the-authentication-scheme
 

 and 
http://www.django-rest-framework.org/api-guide/permissions/#setting-the-permission-policy
 
).

> Thanks 
> Prabath 
> 

Regards,
Xavier,
Linovia.

-- 
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/40D4B51A-F981-4E60-A807-ABE1A1462D36%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


Re: segmentation fault

2015-01-13 Thread Xavier Ordoquy

> Le 13 janv. 2015 à 19:25, Django User <deva.seetha...@gmail.com> a écrit :
> 
> hello
> i keep getting the following error messages that state mod_wsgi was already 
> loaded and segmentation faults. pls. see an example:
> 
> [Tue Jan 13 23:46:11 2015] [error] 
> /usr/local/lib/python2.7/dist-packages/pytz/__init__.py:29: UserWarning: 
> Module mod_wsgi was already imported from None, but 
> /usr/local/lib/python2.7/dist-packages is being added to sys.path
> [Tue Jan 13 23:46:11 2015] [error]   from pkg_resources import resource_stream
> [Tue Jan 13 23:46:12 2015] [notice] child pid 11979 exit signal Segmentation 
> fault (11)
> [Tue Jan 13 23:46:12 2015] [notice] child pid 11993 exit signal Segmentation 
> fault (11)
> 
> how do i go about resolving this? 

You need to ensure that your Python/C libraries are up to date with your system.

Regards,
Xavier Ordoquy,
Linovia.

> kindly let me know.
> 
> thanks in advance.
> 
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com 
> <mailto:django-users@googlegroups.com>.
> Visit this group at http://groups.google.com/group/django-users 
> <http://groups.google.com/group/django-users>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/5839f545-39e6-48dd-a441-263ccbcf3693%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/5839f545-39e6-48dd-a441-263ccbcf3693%40googlegroups.com?utm_medium=email_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <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/28B9D850-1F38-4C20-B19D-681F1772FF9B%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error: No module named polls

2015-01-05 Thread Xavier Ordoquy
Hi,


> Le 5 janv. 2015 à 16:41, ibes ... <tita...@gmail.com> a écrit :
> 
> hello, 
> I am frustrated with django and phyton tutorial it is very difficult
> i'm having a problem with the tutorial of django and python, 
> 
> am using django 1.7.1 and python 2.7 on win xp-sp3 so far it was good, i 
> create everything without problem but in tutorial step where it says: 
> 
> https://docs.djangoproject.com/en/1.7/intro/tutorial01/
> 
> Once you’re in the shell, explore the database API 
> <https://docs.djangoproject.com/en/1.7/topics/db/queries/>:
> 
> i've got the message:
> 
> C:\xampp\htdocs\primerdjango>manage.py runserver
> Traceback (most recent call last):
>   File "D:\xampp\htdocs\primerdjango\manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File 
> "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\core\managem
> ent\__init__.py", line 385, in execute_from_command_line
> utility.execute()
>   File 
> "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\core\managem
> ent\__init__.py", line 354, in execute
> django.setup()
>   File 
> "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\__init__.py"
> , line 21, in setup
> apps.populate(settings.INSTALLED_APPS)
>   File 
> "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\apps\registr
> y.py", line 85, in populate
> app_config = AppConfig.create(entry)
>   File 
> "D:\Python27\lib\site-packages\django-1.7.1-py2.7.egg\django\apps\config.
> py", line 123, in create
> import_module(entry)
>   File "D:\Python27\lib\importlib\__init__.py", line 37, in import_module
> __import__(name)
> ImportError: No module named polls
> 
> i don't know what to do can anyone help, please!!!
> 
> sorry for my bad english…

It looks like Python couldn’t find the « polls » directory.
Maybe you didn’t create it or it is at the wrong location. Could you write us 
where the « polls » directory is, relating to « mysite » ?

Regards,
Xavier Ordoquy,
Linovia.

-- 
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/6CA9FED6-CCA2-4854-B834-8D6F3B74D316%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


Re: Version number comparison and beta

2014-05-01 Thread Xavier Ordoquy
Hi Kevin,

Le 1 mai 2014 à 08:36, Kevin Golding <kevingolding2...@gmail.com> a écrit :

> What is the best practice for doing version number comparisons taking into 
> account the existence of beta version numbers?

What I'm doing with Django is:

django.VERSION <= (1, 7)

I can't remember where I saw this but this worked well for me.

Regards,
Xavier Ordoquy,
Linovia.

-- 
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/6E3068D2-B214-4199-99FD-2138C4FF23FF%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


Re: Middleware being called twice for every request, help?

2014-03-19 Thread Xavier Ordoquy
Hi,

Just remove the Django debug toolbar.
It will call your middlewares to display the result.

Regards,
Xavier,
Linovia.

Le 19 mars 2014 à 18:00, Tyler Bettilyon  a écrit :

> Hello!
> 
> I recently switched my Django environment from using Apache to Gunicorn. 
> After this switch we noticed that our middleware was being called twice for 
> each request. To confirm my suspicion I wrote a new piece of middleware: 
> 
> class TemporaryMiddleware(object):
> def process_request(self, request):
> if not hasattr(request, '_secret'):
> request._secret = uuid.uuid4()
> logging.info("set secret to {0}".format(request._secret))
> else:
> logging.info(request._secret)
> 
> 
> def process_response(self, request, response):
> logging.info("response {0}{1}".format(request._secret, 
> response.status_code))
> return response
> 
> After registering my TemporaryMiddleware I headed back to the logs:
> INFO 2014-03-19 09:32:23,397 middleware.py:26] set secret to 
> bb89e0ab-a30b-42ce-800b-7129a3b323ae
> INFO 2014-03-19 09:32:23,398 middleware.py:28] 
> bb89e0ab-a30b-42ce-800b-7129a3b323ae
> INFO 2014-03-19 09:32:23,841 middleware.py:32] response 
> bb89e0ab-a30b-42ce-800b-7129a3b323ae200
> INFO 2014-03-19 09:32:24,126 middleware.py:32] response 
> bb89e0ab-a30b-42ce-800b-7129a3b323ae200
> 
> If the only change I make is to start the server using:
> python manage.py runserver
> 
> Instead of:
> python manage.py run_gunicorn
> 
> my logs say:
> INFO 2014-03-19 09:48:25,325 middleware.py:26] set secret to 
> 84b011f9-1689-4b2f-8202-01840c249937
> INFO 2014-03-19 09:48:25,842 middleware.py:33] response 
> 84b011f9-1689-4b2f-8202-01840c249937200
> 
> It seems to me that every request is being processed twice. This happens 
> regardless of the number of threads or workers available, and when I run with 
> more than 1 worker and/or more than one thread the process and thread id's 
> for all four logging statements are the same. So I believe one thread is 
> running through all of my middleware twice per request.  
> 
> Has anyone seem anything like this before, or have any idea what might be 
> going on? I've only been Djangoing for ~6 months and sometimes configuration 
> stuff still escapes me. 
> 
> Thanks,
> Tyler Bettilyon
> 
> -- 
> 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/684d2911-715e-4e6a-9ad9-ceda71607c22%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/C3E41B15-9ADC-4C69-8D0B-4DDB83C1EDBE%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamic database routing in Django

2014-03-13 Thread Xavier Ordoquy
Hi Philip,

I'm not sure your sharding will be possible in the way you describe it.

There will be cases for which selecting the database will not be possible. For 
example, Customer.objects.get(name=) won't be able which DB you'll need to 
hit to get the result.
Same goes for a new Customer. How would you know its ID before the DB saves it ?

Regards,
Xavier,
Linovia.

Le 12 mars 2014 à 22:44, Philip Goh  a écrit :

> Hello list,
> 
> In my database, I have a `Customer` table defined in my database that all 
> other tables are foreign keyed on.
> 
> class Customer(models.Model):
> ...
> 
> class TableA(models.Model):
> Customer = models.ForeignKey(Customer)
> ...
> 
> class TableB(models.Model):
> Customer = models.ForeignKey(Customer)
> ...
> 
> 
> I'm trying to implement a database router that determines the database to 
> connect to based on the primary key of the `Customer` table. For instance, 
> `id`s in the range 1 - 100 will connect to Database A, `id`s in the range 101 
> - 200 will connect to Database B. 
> 
> I've read through the Django documentation on 
> [routers](https://docs.djangoproject.com/en/dev/topics/db/multi-db/#using-routers)
>  but I'm unsure if what I'm asking is possible. Specifically, the methods 
> `db_for_read(model, **hints)` and `db_for_write(model, **hints)` work on the 
> **type** of the object. This is not helping me as I need routing to be based 
> on the contents of the instance of the object. The documentation further 
> states that the only `**hints` provided at this moment are an `instance` 
> object where applicable and in some cases no `instance` is provided at all. 
> This doesn't inspire me with confidence as it does not explicitly state the 
> cases when no `instance` is provided.
> 
> I'm essentially attempting to implement application level sharding of the 
> database. Is this possible in Django?
> 
> Kind regards,
> Phil
> 
> -- 
> 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/a6422b0f-deba-4f56-953d-4db250cfd948%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/FD1529CF-2820-482F-80EE-312D11504312%40linovia.com.
For more options, visit https://groups.google.com/d/optout.


Re: when I pip-installed django-debug-toolbar, the latest version of Django was installed automatically.

2014-02-18 Thread Xavier Ordoquy

> On Monday, February 17, 2014 9:56:09 PM UTC-8, jmin...@gmail.com wrote:
> hi Frank,
> 
> I appreciate it but seem that this situation is so unusual  that people do 
> not understand. 
> I have done those already.
> 
> 
> So I do 
> 1) pip uninstall django
> 3) pip uninstall django-debug-toolbar
> 
> 2) pip install django==1.3
> 
> 
> 
> then it says:
> 
> 
> Downloading/unpacking django==1.3
>   Running setup.py egg_info for package django
> 
> warning: no previously-included files matching '__pycache__' found under 
> directory '*'
> warning: no previously-included files matching '*.py[co]' found under 
> directory '*'
>   Requested django==1.3, but installing version 1.6.2
> Installing collected packages: django
>   Running setup.py install for django
> 
> then the version 1.6 is installed. Any solution?  
> 

Depending on how old your pip version is, you may need to clean up things in 
your /tmp.
I have faced similar issues with old pip versions. It happened when an 
installation failed and left temporary package files in /tmp. Whatever the 
version you'll want to install, it'll take the one on the /tmp and will not 
remove it by itself.

The correct workaround is to clean /tmp and try a new installation.

Regards,
Xavier Ordoquy,
Linovia


-- 
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/B7C0BA3B-B52C-449A-902D-7B8D096D39F8%40linovia.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Install Error: " SyntaxError: future feature unicode_literals is not defined "

2014-01-09 Thread Xavier Ordoquy
Hi,

Given the error it looks like you weren’t using python 3.3
For the record, I’m running on osx (10.9), using python 3.3.3 I had no issue 
with this import.

Regards,
Xavier Ordoquy.


Le 9 janv. 2014 à 19:04, Byron Price <byron.h.pr...@gmail.com> a écrit :

> I have Python 3.3.2 running and I'm trying to download Django-1.6.1 
> 
> 
> 
> On Thursday, January 9, 2014 12:39:11 AM UTC-5, Mark Moss wrote:
> What's the version of python you are using? Django 1.5 has dropped support 
> for Python 2.5 (see here and here). Here is another similar problem with OSX.
> 
> 
> - Mark
> Struggling with Django setup? Try the new Instant Django Hosting.
> 
> -- 
> 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/34d7b3c6-b6df-45ec-a35f-1bcaed6190de%40googlegroups.com.
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/DBECDB76-F27E-47AF-8A8F-6A1618003BB0%40linovia.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django tests

2013-11-22 Thread Xavier Ordoquy
Hi,

Tests are regular Python code using Django. The code shouldn’t be different 
from what you write elsewhere.
You’ll find some example about using foreign key by the end of the first 
tutorial page.
In your case, it looks like you’ll need to create a user and add it to the 
model you are testing since they seem to be mandatory.

Regards,
Xavier Ordoquy,
Linovia.

Le 22 nov. 2013 à 09:26, Harjot Mann <harjotmann1...@gmail.com> a écrit :

> On Fri, Nov 22, 2013 at 1:47 PM, Xavier Ordoquy <xordo...@linovia.com> wrote:
>> I feel like you are trying to get too fast into Django.
>> It looks like you should take some time and read the Django’s documentation. 
>> It is written like a book and would give an accurate view of what’s going on.
>> If things are still not clear after that, we’d be interested to hear from it 
>> and understand what didn’t go well so that we could improve the 
>> documentation.
> 
> 
> I have read the documentation and doing according to it. But in
> testing doucumentation, it is not given how to use the foreign key.
> 
> -- 
> Harjot Kaur Mann
> Blog: http://harjotmann.wordpress.com/
> Daily Dairy: http://harjotmann.wordpress.com/daily-diary/
> 
> -- 
> 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/CAB0GQhBJLDmQTHt3JmjVE77vaWneF-tH6mijFdTLmez80ODL%2BA%40mail.gmail.com.
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1D1177BB-070F-4E2B-BE4D-BC117D2D7928%40linovia.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django tests

2013-11-22 Thread Xavier Ordoquy
Hi,

I feel like you are trying to get too fast into Django.
It looks like you should take some time and read the Django’s documentation. It 
is written like a book and would give an accurate view of what’s going on.
If things are still not clear after that, we’d be interested to hear from it 
and understand what didn’t go well so that we could improve the documentation.

Regards,
Xavier Ordoquy,
Linovia.


> Not optional means that are not validated. If yes why?
> I mean these are the compulsory fields, so why we should not give it.
> I used all the compulsory fields but still I am getting the same
> error. And how we can use foreign key in tests.py file ?

-- 
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/69D5D013-1B28-46B6-AA70-82F396540C63%40linovia.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django tests

2013-11-21 Thread Xavier Ordoquy
Hi,

I doubt the error is the same although it might look similar.
Please note that TestCase use setUp instead of setup.

Regards,
Xavier Ordoquy,
Linovia.

Le 22 nov. 2013 à 07:17, Harjot Mann <harjotmann1...@gmail.com> a écrit :

> On Fri, Nov 22, 2013 at 11:17 AM, Charly Román <chack14r...@gmail.com> wrote:
>> Your testcase's name and model's name its the same, fix this.
> 
> 
> Changed it. But still getting the same error. Now the code is this:
> http://tny.cz/941266d9
> 
> -- 
> Harjot Kaur Mann
> Blog: http://harjotmann.wordpress.com/
> Daily Dairy: http://harjotmann.wordpress.com/daily-diary/
> 
> -- 
> 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/CAB0GQhBYbrkqPsskUKg5j9xVAKJZMMPxiKYKx2TL_ckwN1qJDw%40mail.gmail.com.
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/65C25054-BE40-4C1F-87B2-35F4654925E2%40linovia.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: RestFul with Class Based Views best practice

2013-10-29 Thread Xavier Ordoquy
Hi,

You probably want to have a look at django rest framework.
You use can will be easy with it, in particular if you use 
http://django-rest-framework.org/api-guide/viewsets.html#modelviewset

Regards,
Xavier.

Le 29 oct. 2013 à 20:45, pywebdesign  a écrit :

> Hi,
> 
> I am trying to find/develop a best way to name and organize Views class to be 
> consistent and flexible.
> 
> I am working on a project witch involve an model called Song. It's kind of a 
> midi song in a database with attibutes about authors, name ... to make it 
> simple.
> 
> Now I want web pages that permit to create a new song, edit a song, delete it 
> or simply view it.
> I also want a list page that list song by authors, by instrument (a typical 
> search and return a list). the idea is to make the list editable via ajax. 
> people change something on a list and it saves it to the browser when done 
> without quitting the list. Very useful to modify many list at the same time.
> There is also a page to create/upload 5 song at a time.
> 
> I was searching the best structure for my Class Based View. Right now I came 
> up with this one:
> 
> class SongForm
> def get_new_song
> def post_new_song
> 
> def get_modify_song
> def put_song
> 
> def get_delete_song
> def delete_song
> 
> class SongListForm
> def get_list_song(search infos)
> 
> class SongView
> get_Song
> 
> 
> ok that's about it. It look wrong, one big class and to very small one. I 
> would like some pointer to some best practice to create this kind of CRUD as 
> RESTFUL.
> 
> Thank you very much
> 
> 
> 
> -- 
> 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/61688c29-1d49-4d1a-9d04-45192d00c78d%40googlegroups.com.
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/27DD4867-A47A-4E9F-8417-1DF2D6F1E742%40linovia.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Python 3

2013-10-23 Thread Xavier Ordoquy
Hi Andréas,

The thing with python3 is it dropped implicit conversion between binary and 
"textual" strings. That means that:
- you now need to explicitly encode or decode if you need to switch the type of 
string you're using
- any conversion issue will be risen even if you're just using plain ascii 
charset

With python 2, encoding / decoding error where more random because the API were 
not always clear whether they need a string or a unicode and it depended on the 
string value itself.
In python3 this kind of error will happen right from the start.
While I've been porting things to python3, I've seen a couple of places where 
there was latent encoding/decoding errors that weren't identified before.

Also I love Python3 for being more explicit than Python 2.
Another example: import path now only use absolute path. If you want to use a 
relative import, you'll need to be explicit about it (say from . import models).

Best regards,
Xavier,
Linovia.


Le 23 oct. 2013 à 23:15, Andreas Kuhne  a écrit :

> Thomas, interesting.
> 
> Being a scandinavian developer myself, can you give me some examples where 
> Python 3 has worked better for unicode support?
> 
> Regards,
> 
> Andréas
> 
> 2013/10/23 Thomas Weholt 
> My main reason to porting as many as possible of my python projects to Python 
> 3 is proper unicode support. As a Norwegian developer is been terrible to 
> support local characters in some projects with lots of dirty hacks to get it 
> working. In py3 it just works.
> 
> Thomas
> 
> 
> On Wed, Oct 23, 2013 at 5:36 PM, Lee  wrote:
> Is there any particular advantage of using Python 3 at this point 
> specifically in regards to Django projects? I'm starting to build a new 
> application and I am wondering whether its really worth considering the move 
> to Python 3. I've only really read about the disadvantages (3rd party libs 
> mainly) and have seen very little relating to any specific advantages.
> 
> Thanks
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/fcab2249-1b88-405a-9106-dd2b544d3d07%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 
> 
> -- 
> Mvh/Best regards,
> Thomas Weholt
> http://www.weholt.org
> 
> -- 
> 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/CACkDSm9X7zaJDDK3LgLZcsWmPxx0qJW_e7%3D%3D7SWC_fXf7-2jxw%40mail.gmail.com.
> 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CALXYUbkTJFs8NJPfoMG5iibUs-8DZG9GmkgCHsFQSEz0FfX4sQ%40mail.gmail.com.
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/D4EF0235-24A5-4F79-B1D4-799B5A1764BF%40linovia.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Japanese named File - FileUpload django admin throws error

2013-10-21 Thread Xavier Ordoquy
Hi,

I've run into similar issues while saving files with non ascii file names.
In my case, it turns out that supervisor was removing the environment variables 
leave Django left with a C locale (ie, ascii only filenames).
It worked once I added - for example - LANG="en_US.UTF-8", 
LC_ALL="en_US.UTF-8", LC_LANG="en_US.UTF-8".
Make sure you correctly set your locales for the process that runs Django.

Best regards,
Xavier,
Linovia.

Le 21 oct. 2013 à 08:42, Raaj Supramanian  a écrit :

> class FileUpload(models.Model):
> cstr = models.CharField(max_length=50)
> file_nm = 
> models.CharField(max_length=250,editable=False,verbose_name='Name')
> file_type_cd = models.CharField(max_length=10,editable=False, 
> verbose_name='Type')
> file_size_val = models.CharField(max_length=25,editable=False, 
> verbose_name='Size in MB')
> file_upld_dts = models.DateTimeField(default =datetime.datetime.now() 
> ,editable=False, verbose_name='Uploaded Date & Time')
> fileupload = models.FileField(upload_to=fs,verbose_name='File to Upload')
> file_title = models.CharField(max_length=250,verbose_name='Title')
> fileretention = models.IntegerField(default=18,verbose_name = '# months 
> of Retention')
> def __unicode__(self):
> return unicode(self.file_nm)
> 
> This is my django model for File upload functionality, when a try to upload a 
> file which has a japanese name i'm getting below error. 
> 
> 
> Environment:
> 
> 
> Request Method: POST
> Request URL: https://10.0.2.13/myapp/admin/allinone/fileupload/add/
> 
> Django Version: 1.4.2
> Python Version: 2.6.6
> Installed Applications:
> ('django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'django.contrib.admin',
>  'allinone')
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware')
> 
> 
> Traceback:
> File 
> "/opt/venv/django-cmdb/lib/python2.6/site-packages/django/core/handlers/base.py"
>  in get_response
>   111. response = callback(request, *callback_args, 
> **callback_kwargs)
> File 
> "/opt/venv/django-cmdb/lib/python2.6/site-packages/django/contrib/admin/options.py"
>  in wrapper
>   366. return self.admin_site.admin_view(view)(*args, 
> **kwargs)
> File 
> "/opt/venv/django-cmdb/lib/python2.6/site-packages/django/utils/decorators.py"
>  in _wrapped_view
>   91. response = view_func(request, *args, **kwargs)
> File 
> "/opt/venv/django-cmdb/lib/python2.6/site-packages/django/views/decorators/cache.py"
>  in _wrapped_view_func
>   89. response = view_func(request, *args, **kwargs)
> File 
> "/opt/venv/django-cmdb/lib/python2.6/site-packages/django/contrib/admin/sites.py"
>  in inner
>   196. return view(request, *args, **kwargs)
> File 
> "/opt/venv/django-cmdb/lib/python2.6/site-packages/django/utils/decorators.py"
>  in _wrapper
>   25. return bound_func(*args, **kwargs)
> File 
> "/opt/venv/django-cmdb/lib/python2.6/site-packages/django/utils/decorators.py"
>  in _wrapped_view
>   91. response = view_func(request, *args, **kwargs)
> File 
> "/opt/venv/django-cmdb/lib/python2.6/site-packages/django/utils/decorators.py"
>  in bound_func
>   21. return func(self, *args2, **kwargs2)
> File 
> "/opt/venv/django-cmdb/lib/python2.6/site-packages/django/db/transaction.py" 
> in inner
>   209. return func(*args, **kwargs)
> File 
> "/opt/venv/django-cmdb/lib/python2.6/site-packages/django/contrib/admin/options.py"
>  in add_view
>   955. self.save_model(request, new_object, form, False)
> File 
> "/opt/venv/django-cmdb/lib/python2.6/site-packages/django/contrib/admin/options.py"
>  in save_model
>   709. obj.save()
> File 
> "/opt/venv/django-cmdb/lib/python2.6/site-packages/django/db/models/base.py" 
> in save
>   463. self.save_base(using=using, force_insert=force_insert, 
> force_update=force_update)
> File 
> "/opt/venv/django-cmdb/lib/python2.6/site-packages/django/db/models/base.py" 
> in save_base
>   551. result = manager._insert([self], fields=fields, 
> return_id=update_pk, using=using, raw=raw)
> File 
> "/opt/venv/django-cmdb/lib/python2.6/site-packages/django/db/models/manager.py"
>  in _insert
>   203. return insert_query(self.model, objs, fields, **kwargs)
> File 
> "/opt/venv/django-cmdb/lib/python2.6/site-packages/django/db/models/query.py" 
> in insert_query
>   1593. return query.get_compiler(using=using).execute_sql(return_id)
> File 
> 

Re: PostgreSQL OperationalError

2013-10-18 Thread Xavier Ordoquy
If you are using anything other than the devserver, you'll need to reload / 
restart your service in order for your changes to take effects.
Django/webservers differ a couple of things until a request comes. This means 
that if you changed the settings after a first request you may have a some 
threads that don't have correct settings and some that do.

Regards,
Xavier,
Linovia.

Le 18 oct. 2013 à 11:38, Muhammed TÜFEKYAPAN <muhammed...@gmail.com> a écrit :

> Thanks for answer. But if my login and pass didn't match, it always raise 
> error. It just sometimes raise error, sometimes doesn't. 
> 
> 
> 2013/10/18 Xavier Ordoquy <xordo...@linovia.com>
> Hello,
> 
> Your DATABASES settings aren't correct.
> fe_sendauth is about Postgresql complaining the login/password didn't match.
> 
> Regards,
> Xavier,
> Linovia.
> 
> Le 18 oct. 2013 à 10:28, Muhammed TÜFEKYAPAN <muhammed...@gmail.com> a écrit :
> 
>> Hello,
>> 
>> 
>> I just start to publish my app on web. Everything going well but I face a 
>> new problem, before I never face. Site working but sometimes raise error 
>> like this;
>> 
>> OperationalError at /
>> 
>> fe_sendauth: no password supplied
>> 
>> 
>> 
>> Full error looks like this;
>> 
>> OperationalError at /
>> 
>> fe_sendauth: no password supplied
>> Request Method:  GET
>> Request URL: http://www.domain.co/
>> Django Version:  1.5.1
>> Exception Type:  OperationalError
>> Exception Value: 
>> fe_sendauth: no password supplied
>> Exception Location:  
>> /var/www/www.domain.co/env/local/lib/python2.7/site-packages/psycopg2/__init__.py
>>  in connect, line 164
>> Python Executable:   /var/www/www.domain.co/env/bin/python
>> Python Version:  2.7.3
>> Python Path: 
>> ['/var/www/www.domain.co/dictionaryproject',
>>  '/var/www/www.domain.co/env/bin',
>>  '/var/www/www.domain.co/env/lib/python2.7',
>>  '/var/www/www.domain.co/env/lib/python2.7/plat-linux2',
>>  '/var/www/www.domain.co/env/lib/python2.7/lib-tk',
>>  '/var/www/www.domain.co/env/lib/python2.7/lib-old',
>>  '/var/www/www.domain.co/env/lib/python2.7/lib-dynload',
>>  '/usr/lib/python2.7',
>>  '/usr/lib/python2.7/plat-linux2',
>>  '/usr/lib/python2.7/lib-tk',
>>  '/var/www/www.domain.co/env/local/lib/python2.7/site-packages']
>> Server time: Fri, 18 Oct 2013 03:26:32 -0500
>> 
>> 
>> What is the problem and how can I solve it?
>> 
>> 
>> Best.
>> 
>> 
>> -- 
>> 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/108c39f7-dc12-435f-8eb0-77a761708aa7%40googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Django users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/django-users/oM0ayk0Mw0U/unsubscribe.
> To unsubscribe from this group and all its topics, 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/25F0DFE7-2D50-48D2-A9C3-23F2872CFE85%40linovia.com.
> 
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 
> 
> -- 
> Muhammed Tüfekyapan
> İTÜ - Tekstil Müh.
> 532 172 70 66
> 
> -- 
> 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/CA%2BMQMxUNZEHaoWz-aPR_ODKyr92wHefdM0SddHC6yPxf7%3D8rFg%40mail.gmail.com.
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/E4E445DD-20F6-44EE-A876-EE7939D39CE3%40linovia.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: PostgreSQL OperationalError

2013-10-18 Thread Xavier Ordoquy
Hello,

Your DATABASES settings aren't correct.
fe_sendauth is about Postgresql complaining the login/password didn't match.

Regards,
Xavier,
Linovia.

Le 18 oct. 2013 à 10:28, Muhammed TÜFEKYAPAN  a écrit :

> Hello,
> 
> 
> I just start to publish my app on web. Everything going well but I face a new 
> problem, before I never face. Site working but sometimes raise error like 
> this;
> 
> OperationalError at /
> 
> fe_sendauth: no password supplied
> 
> 
> 
> Full error looks like this;
> 
> OperationalError at /
> 
> fe_sendauth: no password supplied
> Request Method:   GET
> Request URL:  http://www.domain.co/
> Django Version:   1.5.1
> Exception Type:   OperationalError
> Exception Value:  
> fe_sendauth: no password supplied
> Exception Location:   
> /var/www/www.domain.co/env/local/lib/python2.7/site-packages/psycopg2/__init__.py
>  in connect, line 164
> Python Executable:/var/www/www.domain.co/env/bin/python
> Python Version:   2.7.3
> Python Path:  
> ['/var/www/www.domain.co/dictionaryproject',
>  '/var/www/www.domain.co/env/bin',
>  '/var/www/www.domain.co/env/lib/python2.7',
>  '/var/www/www.domain.co/env/lib/python2.7/plat-linux2',
>  '/var/www/www.domain.co/env/lib/python2.7/lib-tk',
>  '/var/www/www.domain.co/env/lib/python2.7/lib-old',
>  '/var/www/www.domain.co/env/lib/python2.7/lib-dynload',
>  '/usr/lib/python2.7',
>  '/usr/lib/python2.7/plat-linux2',
>  '/usr/lib/python2.7/lib-tk',
>  '/var/www/www.domain.co/env/local/lib/python2.7/site-packages']
> Server time:  Fri, 18 Oct 2013 03:26:32 -0500
> 
> 
> What is the problem and how can I solve it?
> 
> 
> Best.
> 
> 
> -- 
> 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/108c39f7-dc12-435f-8eb0-77a761708aa7%40googlegroups.com.
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/25F0DFE7-2D50-48D2-A9C3-23F2872CFE85%40linovia.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Official Django tutorial 3: Reverse for 'detail' with arguments '('',)' and keyword arguments '{}' not found.

2013-10-12 Thread Xavier Ordoquy
Hi,

It looks like you are missing the poll in your context.
{% url 'detail' poll.id %} will try to match an url named detail with the 
argument poll.id
However Django says it can't find a reverse for 'detail' with arguments ('',) 
which means that you don't have a poll in your context (or the poll.id is 
empty).
Double check that you already did the part 
https://docs.djangoproject.com/en/1.5/intro/tutorial03/#raising-a-404-error 
since the view is there and that there's no typo in the render(..., {'poll': 
poll})

Regards,
Xavier,
Linovia.

Le 12 oct. 2013 à 17:12, dvgh...@gmail.com a écrit :

> Hi everyone,
> I'm following the official django tutorials to learn Django by building the 
> polls app...
> 
> Everything seemed great until chapter 3.
> 
> I had this link as part of my index template, which was working fine:
> 
> {{ poll.question }}
> however, this is hardcoded and the tutorial suggested a better way was to use:
> 
> {{ poll.question }}
> so that you'll be better of when dealing with huge number of templates and u 
> have to make changes to the url.
> 
> Since I made the above change I get the following errors when I run the app:
> Exception Type:   NoReverseMatch
> Exception Value:  
> Reverse for 'detail' with arguments '('',)' and keyword arguments '{}' not 
> found.
> 
> Usually I could easily read where the error is coming from and deal with it 
> but in this case I can't spot the cause of the error hence I'm unable to 
> progress with my study.
> Any help will be greatly appreciated.
> 
> 
> 
> 
> -- 
> 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/c33a669a-ff0e-44cf-b95a-93296e71150c%40googlegroups.com.
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5CD1F9A1-E964-47D1-B364-EE778C69E3D7%40linovia.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ALLOWED_HOSTS and dynamic dyn site

2013-10-10 Thread Xavier Ordoquy
Hi michael,

I've also noticed a couple of issues with it. Thanks to raven and sentry I 
noticed those requests were missing the hostname in their headers and decided I 
didn't care more.
You might want to use them and see if it's the same for you.

Best regards,
Xavier,
Linovia.

Le 10 oct. 2013 à 18:50, R. Michael Herberger  a 
écrit :

> Hello Django Users,
> 
> I have upgraded to django 1.5 and am getting errors because of the 
> ALLOWED_HOSTS, 
> 
> Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS):
> 
> The HTTP_HOST headers are the current IP address of my server depending on 
> what has been allocated. Even with "*", I am getting the error occassionally. 
> 
> The specifics;
> Ubuntu 12.04 LTS
> Apache 2.2 with mod_wsgi
> An easybox 803a forward requests to the server and updates the dynamic IP 
> service. 
> 
> I do not know if it is advisable but it would be nice to verify  
> ALLOWED_HOSTS with the current IP address? Is it possible to change this 
> function to accomadate  my dynamic IP?
> 
> Any suggestions please let me know.
> 
> Kind regards
> Michael
>  
> 
> -- 
> 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/54dde4d2-7286-4158-bc5d-58fa252f0d0d%40googlegroups.com.
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/EB74B39A-ED25-4E1F-BB7B-D01DBDD8D306%40linovia.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Newbie] Self referencing models

2013-09-12 Thread Xavier Ordoquy
Hello Zoubeida,

models.ForeignKey(self) works (see 
https://docs.djangoproject.com/en/1.5/ref/models/fields/#foreignkey about it).

What sort of error did you get when trying it ?

Regards,
Xavier Ordoquy.


Le 12 sept. 2013 à 09:44, Zoubeida <zzarko...@gmail.com> a écrit :

> Any help?
> 
> Le samedi 8 novembre 2008 07:58:00 UTC+1, sunn a écrit :
> How do I make a foreign key to self? 
> 
> class Page(models.Model): 
> title = models.CharField(max_length=128) 
> display = models.CharField(max_length=64) 
> path = models.CharField(max_length=64) 
> sortorder = models.IntegerField() 
> parent = models.OneToOneField(Page) #Will not work neither will 
> parenttest = models.ForeignKey(Page) #nor 
> parenttest2 = models.ForeignKey(self) 
> def __unicode__(self): 
> return self.display 
> 
> any help appreciated! 
> 
> -- 
> 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.

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


Re: New field in django

2013-09-08 Thread Xavier Ordoquy
Hi,

The message is: "Table 'tcc_report' already exists"

This means that you already created the tables with syncdb which bypassed south 
and you're trying to created them again with south.
You'll be able to recover from this by:
- ensuring your models are in line with your current DB schema
- creating an initial migration (provided that you didn't already create 
migrations)
- fake the initial migration to tell south you already created the schema for 
this application

Then you can change your models, create schema or data migrations and apply 
them.

For more information, have a look at 
http://south.readthedocs.org/en/latest/convertinganapp.html#converting-other-installations-and-servers

Regards,
Xavier.


Le 9 sept. 2013 à 05:51, Harjot Mann  a écrit :

> On Mon, Sep 9, 2013 at 3:46 AM, Roberto López López
>  wrote:
>> You have to fake the migration.
> 
> 
> Didn't get you. Please elaborate.
> 
> -- 
> Harjot Kaur Mann
> Blog: http://harjotmann.wordpress.com/
> Daily Dairy: http://harjotmann.wordpress.com/daily-diary/
> 
> -- 
> 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.

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


Re: Can't decode french characters after switching to PostgrSQL from MySQL

2013-08-22 Thread Xavier Ordoquy
I'm using full utf8.
Whenever I need to import data, I make sure they are utf8 encoded.

an extract from a database dump:

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

[...]

COPY xxx (id, description) FROM stdin;
1   [...]passionnée[...]vêtements[...]bébé très
\.


As you can see, there are all sort of accents which are correctly processed and 
displayed.

Regards,
Xavier.


Le 22 août 2013 à 11:36, Radomir Wojcik  a écrit :

> Xavier , which encoding do you use for french characters with django?
> 
> UTF-8 does not like é, 
> 
> But it says it exists in utf-8:
> U+00E9é   c3 a9   LATIN SMALL LETTER E WITH ACUTE
> http://www.utf8-chartable.de
> 
> -- 
> 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.

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


Re: Can't decode french characters after switching to PostgrSQL from MySQL

2013-08-22 Thread Xavier Ordoquy
Hi

Le 22 août 2013 à 09:52, Radomir Wojcik  a écrit :
> Are french characters UTF-8 Compliant?

As I said, yes. Been using Django + Postgres with french texts and faced no 
issue so far.
You also have a decent Django french user base which would have noticed that 
sort of issues.

Back on our topic, if you set client_encoding to 'LATIN1'; you need to make 
sure your file is latin1 encoded (try the file command, it should give you the 
encoding).
Most of the time, it'll be utf8, so you'll probably need to edit your dump, 
update the client_encoding to utf8, import it again.

Regards,
Xavier.

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


Re: Can't decode french characters after switching to PostgrSQL from MySQL

2013-08-22 Thread Xavier Ordoquy
Hi,

Le 22 août 2013 à 08:25, Radomir Wojcik  a écrit :

> Adding the unicode u to the 'string' as such u'string'  fixes the issue but 
> now I have to add this u to every string that will potentially have a 
> character with a french accent in it? How come MySQL didn't need this? There 
> must be a straight forward answer to this, something that will make Postgres 
> + django handle every string as unicode.

As a french user, I haven't faced encoding issues with Django and Postgres.
As Russell pointed out, you need to make sure your postgres database is utf8 
and the data you imported also were.
Your concerns shows that something's wrong with one of those two things - or 
maybe both.

By the way, if you're using python 2, you shouldn't be using 'string' notation 
for character strings and should be using the u'string' one.
'string' is a binary string while u'string' is a text string.
This is misleading with python 2 as there's implicit conversion between the two 
and utf8 will be used as the default charset which may lead to the kind of 
errors you've faced.

Mysql is more flexible about that but you may have missed that it has something 
like 4 different encoding configuration parameters and your client side 
configuration may have been utf8.
In this regard, postgresql might look too restrictive but it's safer and better.

Best regards,
Xavier.

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


Re: 'FormSet' object has no attribute 'save'

2013-06-23 Thread Xavier Ordoquy
Hi,

Looks like you've missed something in your code. Unfortunately without the 
formset creation / instance creation code, there isn't much we can do.

Regards,
Xavier.

Le 23 juin 2013 à 17:05, Mário Idival  a écrit :

> Hi guys,
> 
> I need of little help with formsets. I want save 3 instances of an form in 
> databases.
> E.G : 
> name
> lastname
> -
> name
> lastname
> -
> name
> lastname
> -
> I try use formset but I'm not getting save, expected this error for me :' 
> ClassNameForSet' object has no attribute 'save'
> Somebody know how i can pass for 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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: South not picking up changes to model, app crashes

2013-05-17 Thread Xavier Ordoquy
Hi

> and then  where I thought it would find the user_id field..
> python manage.py migrate apppython manage.py syncdb

Migrate plays the available migrations but doesn't create a new one.
In order to do that, you need to use the schemamigration command.
The way to do that is explained here: 
http://south.readthedocs.org/en/0.7.6/tutorial/part1.html#changing-the-model


Best regards,
Xavier Ordoquy.

-- 
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: Django 1.5.1 and formsets with more than 1000 initials

2013-04-24 Thread Xavier Ordoquy
Hi Carsten,

When you create your FormSet with formset_factory, the max_number is set to the 
max of 1000 and max_num.
The fact that you set a bigger number of initials doesn't affect this number.
I'm not sure whether the FormSet could extends itself this number if the 
initial_data is larger than 1000. You probably could open a ticket about that.

Please note that a more flexible workaround would be:
> >>> ArticleFormSet = formset_factory(ArticleForm, max_num=len(MyInitials), 
> >>> extra=0)


Regards,
Xavier Ordoquy,
Linovia.


Le 24 avr. 2013 à 21:42, Carsten Fuchs <carsten.fu...@cafu.de> a écrit :

> Hi all,
> 
> using Django 1.5.1, having read 
> <https://docs.djangoproject.com/en/1.5/topics/forms/formsets/#limiting-the-maximum-number-of-forms>,
>  I still have trouble creating a formset with more than 1000 initial forms:
> 
> Following the example at that page, what I'd like to do is, with MyInitials 
> being a list of e.g. 1500 initial values:
> 
> >>> ArticleFormSet = formset_factory(ArticleForm, extra=0)
> >>> formset = ArticleFormSet(initial=MyInitials)
> 
> Now, accessing formset.forms[1000] throws an IndexError exception.
> 
> I understand that this is related to the "Formset denial-of-service" issue 
> mentioned at https://www.djangoproject.com/weblog/2013/feb/19/security/, but 
> isn't max_num supposed to limited the number of *extra* formsets only?
> 
> It is relatively easy to work-around my original problem:
> 
> >>> ArticleFormSet = formset_factory(ArticleForm, max_num=3, extra=0)
> 
> but shouldn't a larger number of initials automatically extend the max_num?
> 
> Best regards,
> Carsten
> 
> -- 
> 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.
> 
> 

-- 
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: Re-usable app for REST API creation with Python 3 support?

2013-04-22 Thread Xavier Ordoquy
Hi Thomas,

You should give a go to Django Rest Framework 
(http://django-rest-framework.org/) as it has been ported to Python3.


Regards,
Xavier Ordoquy,
Linovia.

Le 22 avr. 2013 à 12:08, Thomas Weholt <thomas.weh...@gmail.com> a écrit :

> I'm looking for a re-usable app for django that can help create a REST-ful 
> API, but when trying to install django-piston and django-tastypie in my 
> Python 3.3 virtual environment they both fail. 
> 
> Are there other alternatives? Are they suppose to work under Python 3.3 or am 
> I doing something wrong?
> 
> -- 
> Mvh/Best regards,
> Thomas Weholt
> http://www.weholt.org
> 
> -- 
> 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.
>  
>  

-- 
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: django 1.4.3 to 1.4.4 upgrade fails - Bad magic number Import Error

2013-02-21 Thread Xavier Ordoquy
Hi,

You should consider upgrading to 1.4.5 which fixes that issue.

Best regards,
Xavier

Le 21 févr. 2013 à 09:00, Frank Bieniek  a 
écrit :

> Hi,
> we are using jenkins to build our django stack,
> we changed the django version from 1.4.3 to 1.4.4.
> this results in a
> 
> ImportError: Bad magic number in 
> /x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/contrib/sessions/management/__init__.pyc
> 
> Even deleting all pyc files does not solve the problem.
> We are using python 2.5 on solaris.
> 
> Any suggestion would help, digging the net has not shown fix, beside delete 
> pyc files.
> 
> The same problem appears on another project updating from 1.3.5 to 1.3.6
> 
> Thanks
> Frank
> 
> Traceback below
> 
> 
> Creating test database for alias 'default'...
> Traceback (most recent call last):
>  File "/x86build/dpp/opt/django-auth/authhub/manage.py", line 24, in 
>execute_manager(settings)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/__init__.py",
>  line 459, in execute_manager
>utility.execute()
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/__init__.py",
>  line 382, in execute
>self.fetch_command(subcommand).run_from_argv(self.argv)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/base.py",
>  line 196, in run_from_argv
>self.execute(*args, **options.__dict__)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/base.py",
>  line 232, in execute
>output = self.handle(*args, **options)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django_jenkins/management/commands/__init__.py",
>  line 81, in handle
>if test_runner.run_tests(test_labels):
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/test/simple.py",
>  line 381, in run_tests
>old_config = self.setup_databases()
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django_jenkins/runner.py",
>  line 260, in setup_databases
>return super(CITestSuiteRunner, self).setup_databases()
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/test/simple.py",
>  line 317, in setup_databases
>self.verbosity, autoclobber=not self.interactive)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/db/backends/creation.py",
>  line 271, in create_test_db
>load_initial_data=False)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/__init__.py",
>  line 150, in call_command
>return klass.execute(*args, **defaults)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/base.py",
>  line 232, in execute
>output = self.handle(*args, **options)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/base.py",
>  line 371, in handle
>return self.handle_noargs(**options)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/core/management/commands/syncdb.py",
>  line 40, in handle_noargs
>import_module('.management', app_name)
>  File 
> "/x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/utils/importlib.py",
>  line 35, in import_module
>__import__(name)
> ImportError: Bad magic number in 
> /x86build/dpp/opt/django-auth-venv/lib/python2.5/site-packages/django/contrib/sessions/management/__init__.pyc
> 
> Fatal error: local() encountered an error (return code 1) while executing '. 
> /x86build/dpp/opt/django-auth-venv/bin/activate && python 
> /x86build/dpp/opt/django-auth/authhub/manage.py jenkins'
> 
> 
> 
> -- 
> 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.
> 
> 

-- 
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: Layered Dropdown List

2012-12-24 Thread Xavier Ordoquy
Hi,

Le 24 déc. 2012 à 08:43, CodingDaddy <p...@programmingpapa.com> a écrit :

> I would like to ask your advice on how I can implement layered dropdown list.
> Let's say I have three tables, one called Country, another called State, and 
> the other called 'City'
> And you are adding information about a particular city in admin site.
> So I want to have a dropdown like thie
> 
> Canada
> - BC
> - Alberta
> US
> - California
> - New York
> 
> I am not implementing about countries and states, but this kind of dropdown 
> box is what I would like to get.
> The user or admin can select only the states.
> 
> I would appreciate any input I can get.
> Thank you for reading my question and I hope to hear from you.
> 
> Regards
> 

You'll find how to do this with the MEDIA_CHOICES example here: 
https://docs.djangoproject.com/en/1.4/ref/models/fields/#choices


Regards,
Xavier Ordoquy,
Linovia.

-- 
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: error message on runserver locally

2012-12-15 Thread Xavier Ordoquy
Le 15 déc. 2012 à 16:37, Phil Brant <phil...@gmail.com> a écrit :

> Running that in python interpreter just throws an error "Invalid Syntax"

Without stacktrace, there isn't much we can do.
There might be something wrong in your settings file.

Regards,
Xavier Ordoquy,
Linovia.

-- 
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: error message on runserver locally

2012-12-15 Thread Xavier Ordoquy

Sorry I should have been more explicit. You need to call the manage.py through 
the python interpreter: "python manage.py runserver" because your local 
directory isn't in your paths.

Regards,
Xavier Ordoquy,
Linovia.

Le 15 déc. 2012 à 16:14, Phil Brant <phil...@gmail.com> a écrit :

> I tried "manage.py runserver 8080" there just get "command not found". I've 
> never done it that way in the past but doesn't work either.
> 
> 
> On Sat, Dec 15, 2012 at 3:09 PM, Xavier Ordoquy <xordo...@linovia.com> wrote:
> 
> Have you tried to start them with the manage.py runserver instead of 
> django-admin ?
> 
> Regards,
> Xavier Ordoquy,
> Linovia.
> 
> Le 15 déc. 2012 à 15:38, Phil <phil...@gmail.com> a écrit :
> 
>> Hi Xavier, I tried a project called "boom" too and same message, plus my 
>> other 3 django projects I had working previously all get the same error now.
>> 
>> On Saturday, December 15, 2012 2:34:48 PM UTC, Xavier Ordoquy wrote:
>> Hi Phil, 
>> 
>> test is a python module. Your project name conflicts with it. 
>> You should use another name for your project. 
>> 
>> Regards, 
>> Xavier Ordoquy, 
>> Linovia. 
>> 
>> -- 
>> 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/-/kFwQlmOsSQgJ.
>> 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.
> 
> 
> 
> -- 
> Kind Regards,
> Philip Brant.
> 
> -- 
> 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: error message on runserver locally

2012-12-15 Thread Xavier Ordoquy

Have you tried to start them with the manage.py runserver instead of 
django-admin ?

Regards,
Xavier Ordoquy,
Linovia.

Le 15 déc. 2012 à 15:38, Phil <phil...@gmail.com> a écrit :

> Hi Xavier, I tried a project called "boom" too and same message, plus my 
> other 3 django projects I had working previously all get the same error now.
> 
> On Saturday, December 15, 2012 2:34:48 PM UTC, Xavier Ordoquy wrote:
> Hi Phil, 
> 
> test is a python module. Your project name conflicts with it. 
> You should use another name for your project. 
> 
> Regards, 
> Xavier Ordoquy, 
> Linovia. 
> 
> -- 
> 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/-/kFwQlmOsSQgJ.
> 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: error message on runserver locally

2012-12-15 Thread Xavier Ordoquy
Hi Phil,

test is a python module. Your project name conflicts with it.
You should use another name for your project.

Regards,
Xavier Ordoquy,
Linovia.

-- 
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: Tutorial Part 3: loading index.html in browser

2012-11-24 Thread Xavier Ordoquy
Hi Luisa,

Le 24 nov. 2012 à 23:38, Luisa Beck <emmi.b...@gmail.com> a écrit :

> I'm in the process of going through the Django tutorials. 
> I'm having trouble with loading the index.html file into the browser. I don't 
> see a bulleted-list containing the "What's up" poll from Tutorial 1. Instead, 
> I'm simply seeing the code that I pasted from green box (see middle of the 
> page in the tutorial- I've also pasted it below). 
> The tutorial says "put the following code in that template". Does it mean 
> that the code is supposed to go into the index.html file that I created?

You are probably looking at the file itself instead of the page rendered by the 
server.
Is that the result you had while looking at http://localhost:8000/polls/ ?

Regards,
Xavier Ordoquy.

> Thanks!
> 
> {% if latest_poll_list %}
> 
> {% for poll in latest_poll_list %}
> {{ poll.question }}
> {% endfor %}
> 
> {% else %}
> No polls are available.
> {% endif %}
> 
> -- 
> 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/-/xwta_28JByIJ.
> 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: Location of non-app-specific static files?

2012-11-04 Thread Xavier Ordoquy
Hi,

One thing I've seen - and adopted - is to have one application that contains 
the static files.
It looks like:

> └── mysite
> ├── __init__.py
> ├── settings.py
> ├── theme
> ├── __init__.py
> ├── models.py (empty file)
> └── static


> ├── static
> ├── templates
> ├── urls.py
> └── wsgi.py


Then you add the application in your INSTALLED_APPS and you're done.

Regards,
Xavier Ordoquy,
Linovia.

Le 4 nov. 2012 à 00:23, Ryan <ryan.osborn...@gmail.com> a écrit :

> Hi,
> 
> I have been wondering where people put their non-app-specific static files in 
> their django projects?  For example, the base css file that applies to all 
> pages across the project or perhaps the jquery file?
> 
> Currently I have the following structure:
> 
> .
> ├── app
> │   ├── __init__.py
> │   ├── models.py
> │   ├── static
> │   │   └── app
> │   │   ├── css
> │   │   ├── img
> │   │   └── js
> │   ├── templates
> │   │   └── app
> │   ├── tests.py
> │   └── views.py
> ├── manage.py
> └── mysite
> ├── __init__.py
> ├── settings.py
> ├── static
> ├── templates
> ├── urls.py
> └── wsgi.py
> 
> My STATIC_ROOT setting points to the ./mysite/static directory as this is 
> where I would like collectstatic to dump all the static files for deployment, 
> however this is also the obvious place (for me anyway) to place 
> non-app-specific static files as they apply to the project as a whole like 
> the templates directory at this level.
> 
> Does any one have any input on this?
> 
> Thanks,
> 
> Ryan
> 
> -- 
> 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/-/4H39KqmnTugJ.
> 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: My page cound not load image, help!

2012-10-22 Thread Xavier Ordoquy

Le 22 oct. 2012 à 15:13, Dae_James <daeda...@126.com> a écrit :

> I use ImageField(with upload_to = 'photos') to receive user-uploaded images. 
> And in my template, I want to use (image 
> is the object of ImageField) to display them. However, images can't be 
> displayed. I think it's not about static files. If it is, what's the use of 
> ImageField's url property.

Moreover, images will relate to the MEDIA_*

Static are really meant to be static, ie they won't change as long as you don't 
update your project/applications.
Media are where other files should go. Whether they are uploaded user documents 
or application generated ones, they should go there.

For moreinformation have a look there:
https://docs.djangoproject.com/en/1.4/ref/models/fields/#django.db.models.FileField
And especially the part after: "Using a FileField or an ImageField (see below) 
in a model takes a few steps:"

Regards,
Xavier Ordoquy,
Linovia.

-- 
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: Struggling with static files

2012-10-22 Thread Xavier Ordoquy

Le 22 oct. 2012 à 11:25, Pervez Mulla <mullaper...@gmail.com> a écrit :

> something like this in your setting.py
> 
> STATIC_ROOT = ''/home/john/yourprojectdir/yourappdir/staic/"

This is precisely what you shouldn't do.
The STATIC_ROOT is where files are copied to for production using the 
collectstatic command.
This is not for development and this is not where you should store your 
project's static files.

Regards,
Xavier Ordoquy,
Linovia.

-- 
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: Struggling with static files

2012-10-22 Thread Xavier Ordoquy
Hi,

Your static folder should be declared in STATICFILES_DIRS if you want him to be 
served (see 
https://docs.djangoproject.com/en/1.4/howto/static-files/#basic-usage about 
that).

Please take care to give another name to STATIC_ROOT for production settings.

Regards,
Xavier Ordoquy,
Linovia.


Le 22 oct. 2012 à 10:56, DJ-Tom <eventel...@gmail.com> a écrit :

> Hi,
> 
> I'm fairly new with Django and currently I'm only "playing around" to get a 
> better feeling for the framework.
> 
> I have read the documentation and almost all of the posts here about 
> configuring static files with the development server but can't get it working.
> 
> I wanted to modify the admin login screen to show a company logo, so I copied 
> base_site.html to /templates/admin/ and added this:
> 
>
> 
> 
> This is how my directory structure looks like:
> 
> el_test
>   el_test
> static
>logo.gif
> settings.py
> urls.py
>   templates
> admin
>   base_site.html
> 
> - Settings.py:
> 
> STATIC_ROOT = ''
> STATIC_URL = '/static/'
> STATICFILES_DIRS = (
> )
> STATICFILES_FINDERS = (
> 'django.contrib.staticfiles.finders.FileSystemFinder',
> 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
> )
> 
> I also added the following to urls.py
> 
>urlpatterns += staticfiles_urlpatterns()
> 
> The HTML in the admin logon screen looks like this, so basically the URL 
> seems to be OK
> 
> 
>   
>   Test Admin
> 
> 
> Calling http://localhost:8000/static/logo.gif directly shows a 404 error.
> 
> As far as I have understood this should work with the dev server and 
> debug=true without calling collectstatic
> 
> I have also tried moving the /static/ folder around various locations below 
> the project directory... 
> 
> I'm sure there is only some small thing missing...
> 
> Any help is highly appreciated :-)
> 
> Thomas
> 
> -- 
> 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/-/YqVkguDtVwEJ.
> 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: Postgresql Index & expensive queries [n00bie alert]

2012-10-20 Thread Xavier Ordoquy
Hi,

As Samuel said, the first step is to install Django Debug Toolbar to see what's 
going on with your queries.
Then you'll probably be interested in 
https://docs.djangoproject.com/en/1.4/ref/models/querysets/#prefetch-related

Regards,
Xavier Ordoquy,
Linovia.

Le 20 oct. 2012 à 05:16, Barry Morrison <bdmorri...@gmail.com> a écrit :

> I've got a pretty expensive query...Wondering if I can't speed things up in 
> regards to Postgresql.
> 
> Here is the model: [1] http://dpaste.org/JmEeQ/
> 
> Here is the sql statement: [2] http://dpaste.org/GbfAJ/
> 
> Here is the template: [3] http://dpaste.org/vxRs4/
> 
> Here is the 'guts' of the view: [4] http://dpaste.org/w0b2z/
> 
> Total Postgresql/SQL n00b, so this may be a stupid statement. I'm wondering 
> if an index on '"press_page"."article_id"' wouldn't speed things up a bit?
> 
> In dev, I don't have the amount of data that exists in production, so I can't 
> easily/realistically recreate this scenario.
> 
> FWIW, I'm running:
> 
> Django 12.04
> Postgresql 9.1.5
> Django 1.4.1
> I'm using memcache on the view to cache it, it helped take page load down 
> significantly, but I was wondering if there wasn't something I could do from 
> the DB side of things since I know it's this query that is taking the page so 
> long to load.
> 
> Thanks!
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/U92OjnMgEggJ.
> 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: ./manage.py collectstatic does not collect my folder

2012-10-07 Thread Xavier Ordoquy
Hi,

Django static collects files that are:
- in the application's static directory
- in the directories listed by STATICFILES_DIRS

If using the default storage, files and directories are copied into the 
STATIC_ROOT directory and should be served at the location specified by 
STATIC_URL

The order in which the applications are declared is important.
If I'm not mistaken, the files in STATICFILES_DIRS will override the 
application's static directories.

Regards,
Xavier Ordoquy,
Linovia.

Le 7 oct. 2012 à 06:52, easypie <program...@gmail.com> a écrit :

> I have my project setup so ./manage.py collectstatic will upload all the 
> files in /static/ onto the Amazon S3 server. The only problem is that I have 
> a folder located in .../static/theme/{site layout gfx} that doesn't get 
> collected to the S3 server. I understand that collectstatic ?copies all files 
> located in app/static to the location provided by STATIC_URL. But what about 
> those .css and image files I want to override? For example, I want to 
> override the admin's .css files so I  copy that over to the /static/ folder 
> in my project's root but when I run ./manage.py collectstatic it only moves 
> the admin's .css files located in ../site-packages/django/.../css/{..css} and 
> not the css file that I copied over and then edited? 
> 
> -- 
> 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/-/1A2_Kn1PH1wJ.
> 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: following tutorial / ran into problem....?

2012-10-05 Thread Xavier Ordoquy
Hi,

class Poll(models.Model):
# ...
def __unicode__(self):
return self.question

class Choice(models.Model):
# ...
def __unicode__(self):
return self.choice

You probably have used self.question in the Choice class instead of self.choice

Regards,
Xavier Ordoquy,
Linovia.

Le 6 oct. 2012 à 00:33, TJ Marbois <tmarb...@gmail.com> a écrit :

> hi Im following the first Django tutorial...
> 
> I thought I was doing everything correctly till I hit this spot:
> 
> from 
> 
> https://docs.djangoproject.com/en/1.4/intro/tutorial01/
> 
> everything worked as expected till I got to this specific command in the 
> shell...
> # Create three choices.
> >>> p.choice_set.create(choice='Not much', votes=0)
> 
> I instead got this:
> 
> >>> p.choice_set.create(choice='Not much', votes=0)
> Traceback (most recent call last):
>   File "", line 1, in 
>   File 
> "/Users/tmacbook/Documents/CODING/django/Sites/vTenv/lib/python2.7/site-packages/django/db/models/base.py",
>  line 373, in __repr__
> u = unicode(self)
>   File 
> "/Users/tmacbook/Documents/CODING/django/Sites/myFirstDjangoSite/polls/models.py",
>  line 25, in __unicode__
> return self.question
> AttributeError: 'Choice' object has no attribute 'question'
> 
> Can anyone help?
> 
> cheers
> 
> Tj
> 
> 
> -- 
> 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/-/S0BWK0XjNasJ.
> 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: Sporadic Currency formatting is not possible using the 'C' locale

2012-10-05 Thread Xavier Ordoquy
Hi brian,

If you are using mod_wsgi with apache or nginx, reloading or restarting your 
servers may help.

Regards,
Xavier Ordoquy,
Linovia.

Le 5 oct. 2012 à 21:03, Brian <bri...@potensiacorp.com> a écrit :

> I get this error sporadically. If I refresh the screen 3 or 4 times it loads 
> without the error.
>  
> It is making me nuts trying to figure out why sometimes it's fine other times 
> it fails.
>  
>  
> 
> -- 
> 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/-/2PXA_CemRPgJ.
> 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: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-16 Thread Xavier Ordoquy
Hi Houman

Le 17 août 2012 à 00:05, houmie <hou...@gmail.com> a écrit :

> DealType class has a many to many relationship to sales_item.  Therefore 
> using inline formsets wouldn't be possible.  I have tried it and inlines need 
> foreign key.

DealType has a ForeignKey to Company which is what you're filtering with 
according to your previous mail.
You'll need to have a custom save but that could work.

However I think you should rather go with a dynamic form since you're editing 
only one object (a dealtype).
You'll find an example about it there: 
http://jacobian.org/writing/dynamic-form-generation/

Regards,
Xavier Ordoquy,
Linovia.

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



Re: How to create a formset that contains forms with a dropdown? (Crucial)

2012-08-16 Thread Xavier Ordoquy
Hi,

I'm not sure I understood what you're trying to do.

If you want to display all the SaleItem linked to a company in a formset, then 
inlines are what you're looking for.
You'll find the documentation about them there: 
https://docs.djangoproject.com/en/1.4/topics/forms/modelforms/#inline-formsets

Regards,
Xavier Ordoquy,
Linovia.

-- 
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: Share models between django apps

2012-08-06 Thread Xavier Ordoquy
Hi,

Le 6 août 2012 à 13:53, Ivo Marcelo Leonardi Zaniolo <imarcel...@gmail.com> a 
écrit :

> I'm having problems share models between 3 different apps.
> The models that I share the common app.
> 
> example:
> project /
> common / models.py
> app1/models.py -> import from common.models
> app2/models.py -> import from common.models
> 
> If I configure the application and only the most common one
> app, I have no problems "INSTALLED_APPS (" common "," app1 ")."
> Have to add the two applications that reference the application
> common settings on my second application does not encounter
> models defined in "common".
> I've tried changing the order of configuration INSTALLED_APPS
> But it still fails.
> 
> Thanks for the help

Do you have a common directory or common.py in the app2 directory ?

Regards,
Xavier Ordoquy,
Linovia.

-- 
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: Testing against a multi-db app with un-managed models [django 1.2.3]

2012-07-26 Thread Xavier Ordoquy
Hi Kit

I've been working with a similar problem to solve. I was using Django 1.3.0.
In my case, the legacy database could not be either created nor loaded with 
fixtures as it had lots of composite keys - which is something Django can't 
handle.
The workaround I used to run tests was to override the database driver and 
database creation classes to create the database from sql. I had also to 
override the TestCase so I could do a simple rollback after every test instead 
of recreating the full database - I was using postgres and its database 
creation is extremely long.

If I remember correctly I've faced some issues while overriding the test 
runner, but I can't remember them.

I don't have much informations as I'm on vacation. If you poke me by the end of 
next week I will give you more informations.

Good luck,
Xavier Ordoquy,
Linovia.

-- 
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: 'str' object has no attribute 'resolve'

2012-06-19 Thread Xavier Ordoquy
Hi,

If you just return the original urls.py, there's no way we can know what you 
did and this will prevents us from helping you.
As mentioned by Babatunde, you should give the traceback and the modified urls 
(use dpaste.com for that).

Regards,
Xavier Ordoquy,
Linovia.

Le 19 juin 2012 à 18:34, Sabbineni Navneet a écrit :

> it still shows the same error
> 
> On Tuesday, June 19, 2012 9:23:50 PM UTC+5:30, Sabbineni Navneet wrote:
> This is my url.py file:
> from django.conf.urls.defaults import *
> 
> # Uncomment the next two lines to enable the admin:
> #from django.contrib import admin
> #admin.autodiscover()
> 
> 
> 
> urlpatterns = patterns('',
> 
>  (r'^admin/$', include('django.contrib.admin.urls')),
> )
> # Examples:
> # url(r'^$', 'mysite.views.home', name='home'),
> # url(r'^mysite/', include('mysite.foo.urls')),
> 
> # Uncomment the admin/doc line below to enable admin documentation:
> # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
> 
> # Uncomment the next line to enable the admin:
> Please help
> 
> On Tuesday, June 19, 2012 9:23:50 PM UTC+5:30, Sabbineni Navneet wrote:
> This is my url.py file:
> from django.conf.urls.defaults import *
> 
> # Uncomment the next two lines to enable the admin:
> #from django.contrib import admin
> #admin.autodiscover()
> 
> 
> 
> urlpatterns = patterns('',
> 
>  (r'^admin/$', include('django.contrib.admin.urls')),
> )
> # Examples:
> # url(r'^$', 'mysite.views.home', name='home'),
> # url(r'^mysite/', include('mysite.foo.urls')),
> 
> # Uncomment the admin/doc line below to enable admin documentation:
> # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
> 
> # Uncomment the next line to enable the admin:
> Please help
> 
> -- 
> 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/-/7Y67BJIlJyMJ.
> 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: 'str' object has no attribute 'resolve'

2012-06-19 Thread Xavier Ordoquy

Hi,

1) 
uncomment the two lines to enable admin as it is said:
from django.contrib import admin
admin.autodiscover()


2) use:
url(r'^admin/', include(admin.site.urls)),


Regards,
Xavier Ordoquy,
Linovia.

Le 19 juin 2012 à 17:53, Sabbineni Navneet a écrit :

> This is my url.py file:
> from django.conf.urls.defaults import *
> 
> # Uncomment the next two lines to enable the admin:
> #from django.contrib import admin
> #admin.autodiscover()
> 
> 
> 
> urlpatterns = patterns('',
> 
>  (r'^admin/$', include('django.contrib.admin.urls')),
> )
> # Examples:
> # url(r'^$', 'mysite.views.home', name='home'),
> # url(r'^mysite/', include('mysite.foo.urls')),
> 
> # Uncomment the admin/doc line below to enable admin documentation:
> # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
> 
> # Uncomment the next line to enable the admin:
> Please help
> 
> -- 
> 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/-/RylRYGAjC-oJ.
> 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 Tutorial part 2... Admin Site won't work...

2012-06-17 Thread Xavier Ordoquy
Hi,

The site entry is usually created when the syncdb is run.
What Django version are you using ? If you're using the development version, 
please remove it and install a stable version.

Regards,
Xavier Ordoquy,
Linovia.

Le 16 juin 2012 à 23:16, Laurence MacNeill a écrit :

> I'm going through the django tutorial and I'm having difficulties at the 
> beginning of the second part...
> 
> It tells me to create the admin site, and browse to 127.0.0.1:8000/admin to 
> log in to the admin site I just created...  But when I do that, I get the 
> python server telling me that the site is not found -- it's not the usual 
> apache web-server 404 error, it's definitely coming from the python server, 
> so I know that's running properly.
> 
> Searching through some of the other posts, I came across one responder who 
> asked someone with this same problem to find their site ID in their 
> settings.py file.  Mine says the site ID is 1.  So, armed with that 
> information, I go to the python shell, and type the following:
> >>> from django.contrib.sites.models import Site
> >>> Site.objects.get(id=1)
> 
> And I get the following in response:
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib/python2.6/site-packages/django/db/models/manager.py", line 
> 131, in get
> return self.get_query_set().get(*args, **kwargs)
>   File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line 
> 366, in get
> % self.model._meta.object_name)
> DoesNotExist: Site matching query does not exist.
> 
> So, it seems that the entire site doesn't exist?  I've followed every step in 
> the tutorial exactly, with no problems so far...  Can anyone help me with 
> this?
> 
> Thanks,
> Laurence MacNeill
> Mableton, Georgia, USA
> 
> 
> -- 
> 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/-/Aq18U3mxM1MJ.
> 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: 'ascii' codec can't encode character u'\xe4'

2012-06-14 Thread Xavier Ordoquy
Hi there,

I have faced this kind of error a couple of times when the local wasn't 
correctly set on the system.
Within the python interpreter it was  C (ie ascii) where it should have been 
UTF8.
Up to now, all have been resolved by correctly setting the locals system wide 
and within the web server (see apache setenv as mentioned in earlier post).

Regards,
Xavier Ordoquy,
Linovia.

Le 15 juin 2012 à 07:36, kenneth gonsalves a écrit :

> On Thu, 2012-06-14 at 23:46 +0200, Hendrik Speidel wrote:
>> as an alternative you can provide your own Storage implementation like
>> outlined here:
>> 
>> http://source.mihelac.org/2011/02/6/rename-uploaded-files-ascii-character-set-django/
>> 
>> 
> 
> I have told the client to use only ascii for the time being - but that
> is not a solution - for example assume that the same files are
> accessed/uploaded by other applications. 
> -- 
> regards
> Kenneth Gonsalves
> 
> -- 
> 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: Static files management

2012-05-22 Thread Xavier Ordoquy
Hi,

If you follow what the doc says, there shouldn't be any issue 
(https://docs.djangoproject.com/en/1.4/howto/static-files/#basic-usage)

Regards,
Xavier Ordoquy,
Linovia.

Le 22 mai 2012 à 15:31, Amr Abdel-wahab a écrit :

> I need the exact steps to have this thing working right because I tried alot 
> and its nt working
> 
> -- 
> 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: ModelForms and CreateView Help

2012-05-22 Thread Xavier Ordoquy
Hi,

get is a termination statement for querysets.
please use filter instead.

Regards,
Xavier Ordoquy.

Le 22 mai 2012 à 10:34, wchildsuk a écrit :

> Hi,
> 
> I'm trying to use generic class based views to edit a specific
> queryset but I can't see to get my code working. I've defined queryset
> and relevant form but when the form renders it doesn't contain the
> queryset and when it saves it creates a new entry instead of editing
> the existing one.
> 
> If anyone could help that would be great as I'm completely stuck. A
> copy of my code is available here, http://dpaste.com/751045/
> 
> Thanks in advance
> 
> Wes
> 
> -- 
> 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: UpdateView Creates a new object

2012-05-14 Thread Xavier Ordoquy

No problem.
Redirecting after a POST is a good habit. This will avoid duplicated data if 
the user reloads the page because if you don't redirect, you'll get a second 
POST.

Regards,
Xavier Ordoquy,
Linovia.

Le 14 mai 2012 à 17:42, Michael Ackerman a écrit :

> Thank you very much, that worked. Also, do I have to redirect after POST 
> (success_url)? for example posting a status on facebook or twitter?
> 
> On Sun, May 13, 2012 at 6:06 PM, Xavier Ordoquy <xordo...@linovia.com> wrote:
> Hi,
> 
> You should just use action="" since it will post to the url the page was 
> generated by.
> This will allow you to use a single template for both create and view view 
> while they keep their respective urls.
> As a side note, you should use the url template tag rather than hardcode urls 
> ;)
> 
> Regards,
> Xavier Ordoquy,
> Linovia.
> 
> Le 13 mai 2012 à 21:19, Michael Ackerman a écrit :
> 
>> Yes they are using the same template.
>> Its a very basic template:
>> {% extends "base.html" %}
>> {% block main %}
>> {% csrf_token %}
>> {{ form }}
>> 
>> 
>> {% endblock %}
>> 
>> I figured since update and create were practically the same, I wanted to see 
>> if I could be a bit more DRY. Hence why I'm also looking for a way to see if 
>> I can combine the 2 views into one.
>> 
>> On Sun, May 13, 2012 at 5:40 AM, Xavier Ordoquy <xordo...@linovia.com> wrote:
>> Hi,
>> 
>> What does you form html tag looks like ? Sounds like you're sending the 
>> updateview form to the createview.
>> 
>> Regards,
>> Xavier Ordoquy,
>> Linovia.
>> 
>> Le 13 mai 2012 à 11:59, Michael Ackerman a écrit :
>> 
>>> My updateview seems to be creating another object instead of updating the 
>>> object. The good news is my UpdateView form is filled in with initial data, 
>>> but when I press submit, it creates a new ticket instead of updating the 
>>> old one.
>>> 
>>> #views.py
>>> class create_ticket(CreateView):
>>> model = ticket
>>> form_class = ticket_form
>>> template_name = "create_ticket.html"
>>> success_url = "/tickets/thanks/"
>>> 
>>> class update_ticket(UpdateView):
>>> model = ticket
>>> form_class = ticket_form
>>> template_name = "create_ticket.html"
>>> success_url = "/tickets/thanks/"
>>> 
>>> #models.py
>>> class ticket(models.Model):
>>> title = models.CharField(max_length = 100)
>>> date_created = models.DateTimeField(auto_now_add=True)
>>> description = models.TextField()
>>> ranking = models.PositiveIntegerField(default=0)
>>> 
>>> def __unicode__(self):
>>> return self.title
>>> #urls.py
>>> urlpatterns = patterns('',
>>> (r'^$',
>>> ticket_list.as_view()),
>>> (r'^(?P\d+)/$',
>>> ticket_detail.as_view()),
>>> (r'^create/$',
>>> create_ticket.as_view()),
>>> (r'^thanks/$',
>>> thanks_view.as_view()),
>>> (r'^(?P\d+)/update/$',
>>> update_ticket.as_view()),
>>> )
>>> 
>>> My other 2 quick questions:
>>> - Is the success_url and redirecting necessary? 
>>> - Is it possible to combine the create_ticket view and the update_ticket 
>>> view?
>>> 
>>> All help is greatly appreciated.
>>> 
>>> -- 
>>> 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.
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to dja

Re: UpdateView Creates a new object

2012-05-13 Thread Xavier Ordoquy
Hi,

You should just use action="" since it will post to the url the page was 
generated by.
This will allow you to use a single template for both create and view view 
while they keep their respective urls.
As a side note, you should use the url template tag rather than hardcode urls ;)

Regards,
Xavier Ordoquy,
Linovia.

Le 13 mai 2012 à 21:19, Michael Ackerman a écrit :

> Yes they are using the same template.
> Its a very basic template:
> {% extends "base.html" %}
> {% block main %}
> {% csrf_token %}
> {{ form }}
> 
> 
> {% endblock %}
> 
> I figured since update and create were practically the same, I wanted to see 
> if I could be a bit more DRY. Hence why I'm also looking for a way to see if 
> I can combine the 2 views into one.
> 
> On Sun, May 13, 2012 at 5:40 AM, Xavier Ordoquy <xordo...@linovia.com> wrote:
> Hi,
> 
> What does you form html tag looks like ? Sounds like you're sending the 
> updateview form to the createview.
> 
> Regards,
> Xavier Ordoquy,
> Linovia.
> 
> Le 13 mai 2012 à 11:59, Michael Ackerman a écrit :
> 
>> My updateview seems to be creating another object instead of updating the 
>> object. The good news is my UpdateView form is filled in with initial data, 
>> but when I press submit, it creates a new ticket instead of updating the old 
>> one.
>> 
>> #views.py
>> class create_ticket(CreateView):
>> model = ticket
>> form_class = ticket_form
>> template_name = "create_ticket.html"
>> success_url = "/tickets/thanks/"
>> 
>> class update_ticket(UpdateView):
>> model = ticket
>> form_class = ticket_form
>> template_name = "create_ticket.html"
>> success_url = "/tickets/thanks/"
>> 
>> #models.py
>> class ticket(models.Model):
>> title = models.CharField(max_length = 100)
>> date_created = models.DateTimeField(auto_now_add=True)
>> description = models.TextField()
>> ranking = models.PositiveIntegerField(default=0)
>> 
>> def __unicode__(self):
>> return self.title
>> #urls.py
>> urlpatterns = patterns('',
>> (r'^$',
>> ticket_list.as_view()),
>> (r'^(?P\d+)/$',
>> ticket_detail.as_view()),
>> (r'^create/$',
>> create_ticket.as_view()),
>> (r'^thanks/$',
>> thanks_view.as_view()),
>> (r'^(?P\d+)/update/$',
>> update_ticket.as_view()),
>> )
>> 
>> My other 2 quick questions:
>> - Is the success_url and redirecting necessary? 
>> - Is it possible to combine the create_ticket view and the update_ticket 
>> view?
>> 
>> All help is greatly appreciated.
>> 
>> -- 
>> 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.
> 
> 
> -- 
> 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: UpdateView Creates a new object

2012-05-13 Thread Xavier Ordoquy
Hi,

What does you form html tag looks like ? Sounds like you're sending the 
updateview form to the createview.

Regards,
Xavier Ordoquy,
Linovia.

Le 13 mai 2012 à 11:59, Michael Ackerman a écrit :

> My updateview seems to be creating another object instead of updating the 
> object. The good news is my UpdateView form is filled in with initial data, 
> but when I press submit, it creates a new ticket instead of updating the old 
> one.
> 
> #views.py
> class create_ticket(CreateView):
> model = ticket
> form_class = ticket_form
> template_name = "create_ticket.html"
> success_url = "/tickets/thanks/"
> 
> class update_ticket(UpdateView):
> model = ticket
> form_class = ticket_form
> template_name = "create_ticket.html"
> success_url = "/tickets/thanks/"
> 
> #models.py
> class ticket(models.Model):
> title = models.CharField(max_length = 100)
> date_created = models.DateTimeField(auto_now_add=True)
> description = models.TextField()
> ranking = models.PositiveIntegerField(default=0)
> 
> def __unicode__(self):
> return self.title
> #urls.py
> urlpatterns = patterns('',
> (r'^$',
> ticket_list.as_view()),
> (r'^(?P\d+)/$',
> ticket_detail.as_view()),
> (r'^create/$',
> create_ticket.as_view()),
> (r'^thanks/$',
> thanks_view.as_view()),
> (r'^(?P\d+)/update/$',
> update_ticket.as_view()),
> )
> 
> My other 2 quick questions:
> - Is the success_url and redirecting necessary? 
> - Is it possible to combine the create_ticket view and the update_ticket view?
> 
> All help is greatly appreciated.
> 
> -- 
> 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: No Module Named Generic

2012-05-01 Thread Xavier Ordoquy
Hi,

You should replace django.generic in the urlspatterns string with 
django.views.generic

Regards,
Xavier Ordoquy
Linovia.

Le 1 mai 2012 à 16:30, Gerald Klein a écrit :

> Hi, I am having a problem, where as django doesn't find the generics module. 
> Here is my urls.py
> 
> thanks in advance.
> 
> from django.conf.urls.defaults import *
> 
> from django.views.generic import *
> from coltrane.models import Entry
> 
> 
> entry_info_dict = {
> 'queryset': Entry.objects.all(),
> 'date_field': 'pub_date',
> }
> 
> urlpatterns = patterns('',
> (r'^$', 'django.generic.date_based.archive_index',entry_info_dict, 
> 'coltrane_entry_archive_index'),
> (r'^(?P\d{4})/$', 
> 'django.generic.date_based.archive_year',entry_info_dict, 
> 'coltrane_entry_archive_year'),
> (r'^(?P\d{4})/(?P\w{3})/$', 
> 'django.generic.date_based.archive_month',entry_info_dict, 
> 'coltrane_entry_archive_month'),
> (r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/$', 
> 'django.generic.date_based.archive_day',entry_info_dict,'coltrane_entry_archive_day'),
> (r'^(?P\d{4})/(?P\w{3})/(?P\d{2})/(?P[-\w]+)/$', 
> 'django.generic.date_based.object_detail',entry_info_dict,'coltrane_entry_detail'),
> )
> 
> 
> Gerald Klein DBA
> contac...@geraldklein.com
> www.geraldklein.com
> j...@zognet.com
> 708-599-0352
> 
> Linux registered user #548580 
> 
> 
> 
> 
> -- 
> 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: Bus Error: 10 (Intro Tutorial)

2012-04-20 Thread Xavier Ordoquy
Hi,

I've never faced such issue with Django on OSX.
Do you use or import non pure python apps ?
What python version do you use ? Stock osx one ? homebrew ? homemade ?

Regards,
Xavier.

Le 19 avr. 2012 à 18:16, Harald Sigh Andertun a écrit :

> I'll attach a screenshot. It works for some time, but eventually crashes.
> 
> I'm on Mac OS X Lion.
> 
> 
> 
> Den torsdag den 19. april 2012 17.50.16 UTC+2 skrev David Markey:
> Bus error is usually a very low level problem.
> 
> Can you give a screen shot?
> 
> If you are on linux, also post dmesg.
> 
> On 19 April 2012 16:36, Harald Sigh Andertun  
> wrote:
> Hi all
> 
> I am totally new to django. Have followed the intro tutorial until part 2, 
> but when I start the development server and tries to access the admin page 
> Python crashes immediately. The console prints "Bus error: 10".
> I have been googling for a while now, but can't figure out why this error 
> occurs.
> 
> Is it a code error, or an environment issue?
> 
> I use Python 2.6.2 and Django 1.4.0, and I have choosen sqlite3 as db.
> 
> I hope someone can enlighten me in what direction the problem might be ;)
> 
> Cheers,
> Harald
> 
> -- 
> 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/-/8EP1qv3APR4J.
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/c4km0y-4gekJ.
> 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: how to

2012-04-05 Thread Xavier Ordoquy
Hi,

That's for CharFields :)
IntergerFields in forms have max_value and min_value.

Regards,
Xavier,
Linovia

Le 5 avr. 2012 à 18:12, Hum a écrit :

> does max_length work for IntegerFields?
> 
> -- 
> 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: calculate default values for fields based on the content of other fields

2012-04-05 Thread Xavier Ordoquy
Hi,

I'm not sure I clearly understood your issue.
Do you want some choice fields to limit their choices according to another 
choice field value ?

Regards,
Xavier.

Le 4 avr. 2012 à 15:09, Jaroslav Dobrek a écrit :

> Hello,
> 
> is there a way to calculate default values for certain fields based
> on the content of other fields?
> 
> I am implementing a dictionary. Admins are supposed to add words of
> certain languages and parts-of-speech. Some words of some
> part-of-speech and language are, on one hand, morphologically very
> regular, but, one the other hand, come with a huge number of
> morphological
> forms. This is true for German adjectives: They usually have 183
> morphological forms (if form-meaning pairs are counted). On the other
> hand, there are very few irregular adjectives. The most user-friendly
> way for admins to code German adjectives would be this: The admin adds
> a new adjective and types in the adjective's base form:
> 
> base form: |gut|
> 
> Then he clicks some button or saves the adjective or, ideally, does
> nothing, and the program fills in the 183 fields below, using the base
> form and
> assuming that the adjective is regular:
> 
> attributive positive strong masculine nominative singular: |guter|
> attributive positive strong masculine genitive singular:   |guten|
> attributive positive strong masculine dative singular: |gutem|
> attributive positive strong masculine accusative singular: |guten|
> ...
> attributive comparative strong masculine nominative singular: |
> guterer|
> ...
> 
> The admin now has the possibility to correct the wrong forms before
> saving the adjective. This way, in the vast majority of cases all the
> coding is done completely
> automatically. And for the very few irregular adjectives, the admin
> only has to modify those
> forms that have been guessed wrongly.
> 
> Any ideas how to realize this?
> 
> Jaroslav
> 
> -- 
> 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: Bug in BaseForm?

2012-03-28 Thread Xavier Ordoquy
Hi,

Have you called is_valid() on the form before that ?

Regards,
Xavier Ordoquy,
Linovia.

Le 28 mars 2012 à 15:57, Marcin a écrit :

> Consider the following stack trace (all relevant code is shown in the stack 
> trace):
> 
> In [3]: f.clean()
> ---
> AttributeErrorTraceback (most recent call last)
> C:\Users\Marcin\Documents\oneclickcos\lib\site-packages\django\core\management\commands\shell.pyc
>  in ()
> > 1 f.clean()
> 
> C:\Users\Marcin\Documents\oneclickcos\oneclickcos\mainapp\incorporate_helpers.pyc
>  in clean(self)
> 569 This checks the relations between fields, ensures consistent 
> state, and exports bits about the state of the form that can be used in 
> subsequent
> validations
> 570 """
> --> 571 cleaned_data = super(IncorporateForm, self).clean()
> 572 #logger.debug('IncorporationForm.cleaned_data: ' + 
> str(cleaned_data))
> 
> 573 try:
> 
> C:\Users\Marcin\Documents\oneclickcos\oneclickcos\mainapp\incorporate_helpers.pyc
>  in clean(self)
> 402
> 403 def clean(self):
> --> 404 cleaned_data = super(CreateForm, self).clean()
> 405 # trying to use an empty pk can result in a ValueError. 
> Easier to expunge.
> 
> 406 if cleaned_data.get('pk', None) == '': del cleaned_data['pk']
> 
> C:\Users\Marcin\Documents\oneclickcos\lib\site-packages\django\forms\forms.pyc
>  in clean(self)
> 315 association with the field named '__all__'.
> 316 """
> --> 317 return self.cleaned_data
> 318
> 319 def has_changed(self):
> 
> AttributeError: 'IncorporateForm' object has no attribute 'cleaned_data'
> 
> As you can see, my code conforms to the examples at 
> https://docs.djangoproject.com/en/1.4/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other.
> 
> However, the error comes from BaseForm's clean method, which expects a 
> cleaned_data property or attribute to exist. What gives? Is this a bug in 
> django?
> 
> -- 
> 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/-/_yqLTmCFK4MJ.
> 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 application performance estimates?

2012-03-15 Thread Xavier Ordoquy

Le 15 mars 2012 à 09:34, Sithembewena Lloyd Dube a écrit :

> Xavier, thanks for the link. I'm watching it and I reckon it could help 
> address the query.

This being said, because it is technically possible doesn't mean it is easy or 
will not cost time/money to get there.
One would argue that once you hit performance issues - with a decent code base 
- you'll probably be making enough money to invest on a scalability issues.

Regards,
Xavier Ordoquy,
Linovia.

-- 
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 application performance estimates?

2012-03-15 Thread Xavier Ordoquy

Le 15 mars 2012 à 09:04, kenneth gonsalves a écrit :

> On Thu, 2012-03-15 at 09:46 +0200, Sithembewena Lloyd Dube wrote:
>> - concurrent active users
>>   - emails per day
>>   - lessons uploaded on the system
>>   - etc.
>> 
>> 
>> How do I address this sort of query? 
> 
> actually this has nothing to do with django. It depends on hardware.

and architecture.
Have a look at 
http://blip.tv/pycon-us-videos-2009-2010-2011/pycon-2011-disqus-serving-400-million-people-with-python-4898303
The talk will give you an idea of what's possible with Python & Django. First 
part will most probably speak to non technicals.

Regards,
Xavier Ordoquy.
Linovia.

-- 
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: Getting URL from within a template

2012-03-13 Thread Xavier Ordoquy

Le 13 mars 2012 à 18:40, Larry Martell a écrit :

> On Tue, Mar 13, 2012 at 11:26 AM, Xavier Ordoquy <xordo...@linovia.com> wrote:
>> Hi
>> 
>> Le 13 mars 2012 à 18:11, larry.mart...@gmail.com a écrit :
>> 
>>> From within a template can I find out the URL that caused the template
>>> to be invoked?
>> 
>> You usually should have the request object in your template. See 
>> https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.path
>>  to get the url.
>> 
> 
> But how do I access that in the template? I tried HttpRequest.path and
> {{ HttpRequest.path }} and neither gives me the URL.

{{ request.path }}
just make sure you have RequestContext if you use render_to_response.

Regards,
Xavier.

-- 
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: Getting URL from within a template

2012-03-13 Thread Xavier Ordoquy
Hi

Le 13 mars 2012 à 18:11, larry.mart...@gmail.com a écrit :

> From within a template can I find out the URL that caused the template
> to be invoked?

You usually should have the request object in your template. See 
https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.path
 to get the url.

Regards,
Xavier.

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



Re: How-to for static files?

2011-11-21 Thread Xavier Ordoquy
Hi,

> What follows are my current settings.  In settings.py, I have:
> 
> STATIC_URL = '/static/'
> INSTALLED_APPS = ('django.contrib.staticfiles',)

In order to get their static files served, apps need to be listed in the 
INSTALLED_APPS list.
As you don't mention it, you probably need to add myapp in the INSTALLED_APPS.

Regards,
Xavier,
Linovia.

-- 
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: Serving up CSS files in development

2011-11-07 Thread Xavier Ordoquy
Hi,

Where did you put your static files ?
I noticed that your STATICFILES_DIRS is empty which means you don't have any 
static files on the project level.
What the docs say about this:

Your project will probably also have static assets that aren’t tied to a 
particular app. The STATICFILES_DIRS setting is a tuple of filesystem 
directories to check when loading static files. It’s a search path that is by 
default empty. See the STATICFILES_DIRSdocs how to extend this list of 
additional paths.

Regards,
Xavier.

Le 8 nov. 2011 à 04:55, M. Herold a écrit :

> This is driving me insane. I've done it what feels like 6 different
> ways and for whatever reason, none of them appear to work. The worst
> part is it's something so simple: I want to link to a css file on my
> system. Why does this have to be so ridiculous before I get the
> project into production? Here are the two tutorials that seem the most
> relevant:
> 
> https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
> 
> http://stackoverflow.com/questions/446026/django-how-do-you-serve-media-stylesheets-and-link-to-them-within-templates
> 
> And here's what I have:
> 
> settings.py
> STATIC_ROOT = '/Users/digitallimit/DjangoProjects/mherodev/'
> STATIC_URL = '/static/'
> ADMIN_MEDIA_PREFIX = '/static/admin'
> STATICFILES_DIRS = (
> )
> STATICFILES_FINDERS = (
>'django.contrib.staticfiles.finders.FileSystemFinder',
>'django.contrib.staticfiles.finders.AppDirectoriesFinder',
> )
> 
> urls.py
> if settings.DEBUG:
>urlpatterns += patterns('',
>(r'^static/(?P.*)$', 'django.views.static.serve',
> {'document_root': settings.STATIC_ROOT}),
>)
> 
> Worst cast, I'll just embed the CSS directly, but this is silly. It
> should be the easiest thing in the world.
> 
> -- 
> 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: static files in django

2011-10-14 Thread Xavier Ordoquy
Hi,

It looks like you don't have the static configured in your urls. Have a look 
here:
https://docs.djangoproject.com/en/1.3/howto/static-files/#basic-usage

Regards,
Xavier.

Le 14 oct. 2011 à 18:54, Pulkit Mehrotra a écrit :

> hey i am having problem loading my static files in django 1.3
> 
> Here is my template:http://pastebin.com/nr7Z97SJ
> here is my static file : http://pastebin.com/mEPYMGFt
> here is my url file:http://pastebin.com/Dsz5T9zh
> 
> I have given the right address in staticfiles_dir but still the problem 
> persists and the css files are also stored correctly
> 
> Please find the prob
> 
> -- 
> 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/-/73yT1fwoN-YJ.
> 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: Second coming of Java?

2011-10-13 Thread Xavier Ordoquy

Le 13 oct. 2011 à 17:06, Maksymus007 a écrit :

> 
> 
> On Thu, Oct 13, 2011 at 4:59 PM, Javier Guerra Giraldez  
> wrote:
> On Thu, Oct 13, 2011 at 9:52 AM, Maksymus007  wrote:
> > must works with some other solutions where choice of using SOAP over REST
> > was made years ago.
> 
> often because some years ago, REST wasn't a buzzword-compliant
> acronym.  anybody who suggested CRUD-over-HTTP (*) would've been
> quickly vetoed out of the design committee meetings.
> 
> 
> (*) yes, i know REST is totally not CRUD.  tell that to those
> 'enterprise architects' in the '90s
> 
> 
> True, but that how things are, nothing to argue more about. Django (and 
> Python in general) do not like SOAP, and it's DJango problem, not SOAP, 
> whatever some "cool developers who are typically to afraid of new things" say 
> :/

Hi,

I hardly see where this is a Django problem. Microsoft (1) and Google (2) 
dropped SOAP support. This is a general move from the non pure java enterprises.

That put aside, if you are feeling Django is missing a proper SOAP support, you 
can still develop one.
If there's really a need for it for java world enterprises, you'll probably 
find help from others for that.

Xavier.

(1) http://technet.microsoft.com/en-us/library/cc280436.aspx
(2) http://code.google.com/intl/fr-FR/apis/soapsearch/



-- 
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: STATIC_ROOT confusion

2011-10-08 Thread Xavier Ordoquy

Le 8 oct. 2011 à 17:23, Markus Gattol a écrit :

> Yeah, read that post and I disagree. Introducing yet another name on the 
> filesystem (theme) certainly isn't helping people (this thread and many 
> others show there's enough confusion already). It makes more sense to have a 
> 1:1 mapping between variable naming in settings.py and directories on the 
> filesystem e.g. STATIC_ROOT to static_root, STATIC_DIRS to static/. 
> Plus, Django is not Joomla or Plone or... so thinking in terms of "themes" is 
> semantically wrong as it makes you think of Django as a CMS (one layer to 
> high).


Then forget about STATIC and stick to MEDIA.
I feel the STATIC way is much better for production because it keeps the real 
static data away from more dynamic data (uploaded or computed files) but it 
requires some comprehension of what one does.

Regards,
Xavier,
Linovia.

-- 
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: Class Views Questions

2011-10-08 Thread Xavier Ordoquy

Le 8 oct. 2011 à 16:12, CrabbyPete a écrit :

> I am fooling around with django generic class views, and I was
> wondering if its possible to actually build class views per item for
> example I have the following class view.
> 
> 
> class TeamView( View, TemplateResponseMixin ):
>template_name = 'team.html'
> 
>def get(self, request):
>if 'team' in request.GET:
>team = Team.objects.get(id = request.GET['team'])
>form = TeamForm( instance = team )
>else
>team = None
>form = TeamForm( )
> 
>return self.render_to_response({'form':form})
> 
>def post(self, request):
>form = TeamForm(request.POST)
> 
>if not form.is_valid():
>return self.render_to_response({'form': form})
> 
>
> 
> I want to use this class to also delete the team. I love to use a
> method by itself by adding
>   def delete(self,request)
>   if 'team' in request.GET:
>team = Team.objects.get(id = request.GET['team'])
>team.delete()
> 
> Is there a way to specify this in url.py and get around the dispatch
> for the get?
> 
> Any advise appreciated.


Hi,

You have CreateView / UpdateView for that.

Regards,
Xavier,
Linovia.

-- 
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: STATIC_ROOT confusion

2011-10-08 Thread Xavier Ordoquy

Le 8 oct. 2011 à 15:27, Markus Gattol a écrit :

> Here's what I think is semantically good distinction:
> 
> PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))   (that's the dir 
> containing your settings.py, that dir is usually one dir below your 
> virtualenv, I simply name it "pr". You can then use PROJECT_ROOT to reference 
> such as:
> 
> STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static_root')
> STATIC_URL = '/static/'
> STATICFILES_DIRS = (
> os.path.join(PROJECT_ROOT, 'static/css'),
> os.path.join(PROJECT_ROOT, 'static/img'),
> os.path.join(PROJECT_ROOT, 'static/js'),
> )
> STATICFILES_FINDERS = (
> 'django.contrib.staticfiles.finders.FileSystemFinder',
> 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
> )
> 
> PROJECT_ROOT, "pr" on the filesystem is what you get when you run 
> django-admin.py startproject pr after you run mkvirtualenv foo.com (foo.com 
> would then be the root of your virtualenv; some also call it SITE_ROOT in 
> Django context because they keep web server config, Sass files, etc. there). 
> Here's the dir structure I came to enjoy, also because it maps nicely to the 
> settings posted above:

Hi,

Your STATICFILES_DIRS should not be set to static.
Create a new theme directory, put your files there and update your 
STATICFILES_DIRS.
Have a look at http://www.linovia.com/blog/django-staticfiles-troubleshooting/ 
for an example.

Regards,
Xavier.

-- 
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: STATIC_ROOT confusion

2011-10-07 Thread Xavier Ordoquy
HI,

You don't need STATIC_ROOT while using your dev server.
If you have a look 
https://docs.djangoproject.com/en/1.3/howto/static-files/#basic-usage it isn't 
even mentionned in the basic usage section.

Regards,
Xavier.

Le 8 oct. 2011 à 04:13, Roy Smith a écrit :

> I'm mystified why django (under runserver) is not finding my static
> files.  I'm running django-1.3.1.  The relevant parts of my
> settings.py file are:
> 
> STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
> STATIC_URL = '/static/'
> 
> I have a file in my static directory, a file named foo.  If I do a GET
> on http://localhost:8000/static/foo, I get an 404 with the message,
> "'foo' could not be found".
> 
> I have commented django.contrib.staticfiles out of my settings.py
> file.  For now, I just want to drop my static files manually into my
> static directory.
> 
> -- 
> 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: Easy question (I hope)

2011-10-07 Thread Xavier Ordoquy
Hi,

Create a models directory and have an __init__.py file within.
Put the models you want to import in that file and you are good to go.

Regards,
Xavier.

Le 7 oct. 2011 à 16:39, bcrem a écrit :

> Howdy,
> 
> I come from a C/C++ background, getting into some django/python now.
> I'm used to a one-class/one-file paradigm, and don't much like
> sticking all the models for an app in models.py.  It's a minor thing,
> I know...
> 
> Is there any way to seperate out these classes, and still have syncdb
> pick them up & update your database for you?
> 
> Thanks,
> bc
> 
> -- 
> 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 1.3 upgrade problem

2011-10-02 Thread Xavier Ordoquy
Hi,

I'm a bit curious about the ModPythonRequest object which makes me think you 
are using mod_python.
If this is the case, you should note that its support is deprecated:

Support for mod_python has been deprecated, and will be removed in Django 1.5. 
If you are configuring a new deployment, you are strongly encouraged to 
consider using mod_wsgi or any of the other supported backends.


Regards,
Xavier.

Le 2 oct. 2011 à 16:52, shiva a écrit :

> I recently updgraded to django 1.3. After the upgrade, I get the
> following error whenever I used request.POST:
> 
> Traceback (most recent call last):
> 
> File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py",
> line 86, in  get_response
> response = None
> 
> File "/public/gdp/trunk/src/ukl/lis/process/utils/error_handler.py",
> line 15, in __call__
> return self.function(*args, **kwargs)
> 
> File "/usr/lib/python2.4/site-packages/django/views/decorators/
> cache.py", line 30, in _cache_controlled
> # and this:
> 
> File "/public/gdp/trunk/src/ukl/lis/process/authentication/views.py",
> line 438, in login
> form = loginForm(request.POST)
> 
> File "/usr/lib/python2.4/site-packages/django/core/handlers/
> modpython.py", line 101, in _get_post
> self._load_post_and_files()
> 
> AttributeError: 'ModPythonRequest' object has no attribute
> '_load_post_and_files'
> 
> -- 
> 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: can't get STATICFILES to work (Django dev version)

2011-09-26 Thread Xavier Ordoquy
Hi,

Using a static directory like that on the development server sounds wrong and 
you'll most probably have issues when the site goes live.

>From what you said, it looks like you are confusing STATICFILES_DIRS and 
>STATICFILES_ROOT.

Regards,
Xavier.


Le 27 sept. 2011 à 05:29, nara a écrit :

> Good news, my static files finally work. (I wanted to make
> one last try before giving up). Bottom line, I did not
> have to make any changes to my original settings.py or urls.py.
> All I did: created a static dir. under my app's directory, placed
> the css files under it, and put '/static/css/blueprint/screen.css' to
> refer to the external css. That was it.
> 
> Here is the head section of my template file, list.html:
>   
>   type="text/css" media="screen, projection">
>   type="text/css" media="print">
>  
> 
> 
> Thanks
> Nara
> 
> On Sep 26, 6:02 pm, nara <nar...@gmail.com> wrote:
>> Xavier,
>> 
>> I followed the blog, and at the end, my css files were not getting
>> pulled in.
>> I then tried doing a ./manage.py collectstatic, and this does collect
>> all
>> static files. Unfortunately, running the server still does not serve
>> my
>> css files.
>> 
>> I have spent too many cycles on this issue now. I will go back to my
>> workaround of just placing css inline in the templates, and later,
>> use Apache on my local machine to serve the css files.
>> 
>> Thanks
>> Nara
>> 
>> On Sep 25, 2:44 pm, Xavier Ordoquy <xordo...@linovia.com> wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hi,
>> 
>>>> I have read and followed the docs on static files.
>>>> django.contrib.staticfiles is in INSTALLED_APPS
>>>> (by default), and I have set STATICFILES_DIRS to where my static files
>>>> are (/home/nara/media). (I have
>>>> tried with and without a slash at the end of this absolute file path).
>> 
>>> Static files aren't media. You should keep them separated.
>> 
>>>> I am confused about whether ./manage.py collectstatic is a necessary
>>>> step for static files to work, I didn't think so, and have not done
>>>> that.
>> 
>>> It isn't if you aren't on production stage (ie, DEBUG=False).
>> 
>>> I have started a post on how to setup static files. It isn't finished yet 
>>> but might help you to set it 
>>> up:http://www.linovia.com/blog/django-staticfiles-howto/
>> 
>>> Regards,
>>> Xavier.
> 
> -- 
> 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: DB: working with databases

2011-09-25 Thread Xavier Ordoquy

Le 26 sept. 2011 à 01:48, Russell Keith-Magee a écrit :

> On Mon, Sep 26, 2011 at 12:13 AM, Xavier Ordoquy <xordo...@linovia.com> wrote:
>> Hi,
>> Database will be better designed if you let django orm create them first and
>> you add your tuning after.
>> However, you can still work with non Django generated database.
>> django-extensions application even provides an inspectdb that will guess
>> most of your models from the database schema.
> 
> Erm... *Django* provides inspectdb, not django-extensions. It's part
> of Django's core.
> 
> Yours,
> Russ Magee %-)

My bad, I apologizes for that.
This being said, on the topic:
https://docs.djangoproject.com/en/1.3/howto/legacy-databases/

Regards,
Xavier,
Linovia.

-- 
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: can't get STATICFILES to work (Django dev version)

2011-09-25 Thread Xavier Ordoquy
Hi,


> I have read and followed the docs on static files.
> django.contrib.staticfiles is in INSTALLED_APPS
> (by default), and I have set STATICFILES_DIRS to where my static files
> are (/home/nara/media). (I have
> tried with and without a slash at the end of this absolute file path).

Static files aren't media. You should keep them separated.

> I am confused about whether ./manage.py collectstatic is a necessary
> step for static files to work, I didn't think so, and have not done
> that.

It isn't if you aren't on production stage (ie, DEBUG=False).

I have started a post on how to setup static files. It isn't finished yet but 
might help you to set it up:
http://www.linovia.com/blog/django-staticfiles-howto/

Regards,
Xavier.

-- 
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: DB: working with databases

2011-09-25 Thread Xavier Ordoquy
Hi,

Database will be better designed if you let django orm create them first and 
you add your tuning after.

However, you can still work with non Django generated database. 
django-extensions application even provides an inspectdb that will guess most 
of your models from the database schema.

Regards,
Xavier,
Linovia.


Le 25 sept. 2011 à 18:02, Tanuja a écrit :

> Is it possible to work with databases in the "traditional" way? I mean:
> Design, create, manage the database natively
> Have batch processes to insert and mange data
> Connect this data to a django-based website
> What tools are there to do this? Is this an inefficient approach in the 
> django world?
> 
> Alternatively, if I create the database using model.py:
> Then need to make changes to the database as we go along, without deleting 
> data, how can this be done?
> How do I define triggers, indexes, etc in model.py?
> 
> Thanks much. I am a newbie. Clearly.
> 
> -- 
> 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/-/AvAVd3SH0JsJ.
> 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: Accessing attributes on ManyToManyField table

2011-09-25 Thread Xavier Ordoquy
Hi,

You'll need to acces it through the membership_set:

person_instance.membership_set.date_joined

Regards,
Xavier,
Linovia.


Le 25 sept. 2011 à 17:22, mcjffld a écrit :

> 
> In the documentation (which really is great) there is this example
> 
> class Membership(models.Model):
>person = models.ForeignKey(Person)
>group = models.ForeignKey(Group)
>date_joined = models.DateField()
>invite_reason = models.CharField(max_length=64)
> 
> 
> My question is, is there a way to get the these attributes through the
> Group or Person data?
> 
> I want to render
> 
> "The Beatles", "Ringo Starr", "Needed a new drummer."
> "The Beatles", "Paul McCartney", "Wanted to form a band."
> 
> 
> I get get from the group to the person, from the person to the group,
> but I don't see how to get to the data in the intermediate table.
> 
> Is that data only available in querying?
> 
> 
> thanks,
> 
> Michael
> 
> -- 
> 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: Programming logic in Classed Based FormView or in the Form Itself?

2011-09-22 Thread Xavier Ordoquy
Hi,

Nothing prevents you to put your tests in the form_valid and render the same 
page with your errors.

Regards,
Xavier,
Linovia.

Le 22 sept. 2011 à 17:14, Kurtis a écrit :

> Hey,
> 
> I'm trying to figure out the best way to do this. I have a FormView
> and an associated Form. In my Form, I take care of all of the
> validation and cleaning as far as the input goes.
> 
> However, I need to put in some more logic such as saving the user,
> logging in a user, and whatever else the future holds. I can do this
> in my Class Based View just fine within the is_valid() method.
> 
> The problem comes when I need to raise an exception. I'm not sure what
> kind of an exception to raise or how to present it back to the user.
> For example, if a user tries to create an account and the email
> address is already in use, I want to be able to display that message
> to them with the form.
> 
> I know that authentication is a bad example on this since most of this
> really could be done from the Form. But I have a feeling that in the
> future there will be places I need to actually do this stuff from the
> View itself.
> 
> Are there any suggestions on a good, or conventional, way to do this?
> Basically it boils down to this -- with Class Based FormViews, should
> the logic for *everything* be pushed into the Form itself? Or should
> it be split up between the Form (validation) and the View (everything
> else) like I am trying to do?
> 
> Any examples would also be very helpful!
> 
> Thanks
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

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



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

2011-09-21 Thread Xavier Ordoquy
Hi,

You can also use get_success_url for that:

class ContactView(generic.FormView):
form_class = ContactForm

def get_success_url(self):
return reverse('contact-sent')

Regards,
Xavier

Linovia.

Le 21 sept. 2011 à 00:08, Daniel P a écrit :

> Same problem. You'r not alone!
> 
> this is also a solution: http://djangosnippets.org/snippets/2445/
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-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 admin - utf8 filename

2011-07-19 Thread Xavier Ordoquy

Le 19 juil. 2011 à 16:32, galgal a écrit :

> How can I get rid of error when uploading files with utf8 name?
> I can't find any solution:/

Hi,

There's nothing to do except make sure your LANG is set to something such as 
en_US.UTF-8.
If you are using apache, check you /etc/apache2/envvars

Regards,
Xavier.

-- 
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: Serving static files weirdness

2011-07-08 Thread Xavier Ordoquy
Hi,

If you want help, you'll need to provide more information. What django version, 
what env (wsgi, devserver), what's your admin media and so on.

Regards,
Xavier.

Le 8 juil. 2011 à 04:40, neridaj a écrit :

> I had my static files being served form media i.e., the tree looked
> like this:
> 
> media/
> /css
> /js
> /images
> 
> with this in my url conf:
> if settings.SERVE_MEDIA_FROM_DJANGO:
>urlpatterns += patterns('',
>(r'^media/(?P.*)$', 'django.views.static.serve',
> {'document_root': r'media'}),
>(r'^tiny_mce/(?P.*)$', 'django.views.static.serve',
> { 'document_root': r'media/js/tiny_mc' }),
> )
> 
> I then switched it to this:
> 
> static/
> /css
> /js
> /images
> 
> with this in my url conf:
> if settings.SERVE_MEDIA_FROM_DJANGO:
>urlpatterns += patterns('',
>(r'^static/(?P.*)$', 'django.views.static.serve',
> {'document_root': r'static'}),
>(r'^tiny_mce/(?P.*)$', 'django.views.static.serve',
> { 'document_root': r'static/js/tiny_mc' }),
> )
> 
> I don't understand why changing media to static has stopped django
> from serving static files, any ideas?
> 
> Cheers,
> 
> J
> 
> -- 
> 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/python performance vs play/java

2011-07-05 Thread Xavier Ordoquy
Hi,

Is there anyway you can upload the project to bitbucket or github ?

Regards,
Xavier.

Le 6 juil. 2011 à 01:31, drakkan a écrit :

> Hi,
> 
> thanks for your comments, I installed django-debug toolbar and I can
> confirm I'm doing similar queries from both django and play. The query
> I do with hibernate in play should be slower since I'm doing a left
> outer join while django do an inner join, since the field on which I
> join cannot be null.
> 
> I tryed gunicorn but it gives similar performance to uwsgi, I'm
> testing on my latptop (1 core). Maybe there is something wrong in my
> template but it is basically a base.html and then index.html that
> extends base.html, additinally I have some "include "
> where other.html is a small fragment of code
> 
> On 6 Lug, 01:07, Jonas Geiregat  wrote:
>> We all know python is slower in raw execution speed than it's brother Java 
>> but I can't imagine it to be _that_ slow.
>> 
>> Maybe there's something wrong with the queries you perform. Django's ORM is 
>> know for it's 'hidden execution' of queries. Some more insight in your 
>> querying code might be useful.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hi,
>> 
>>> I did a small test app that basically render a web page and do 3
>>> queries to the database (these queries are needed to fetch some data
>>> displayed on the web page). I deployed this app with nginx+uswgi
>> 
>>> here is the relevant nginx conf:
>> 
>>> location / {
>>>uwsgi_pass 127.0.0.1:49152;
>>>include uwsgi_params;
>>>}
>> 
>>> I configured nginx to serve the static files too:
>> 
>>> location /media {
>>>root ;
>>>autoindex on;
>>>}
>> 
>>> I launch uswgi as follow:
>> 
>>> uwsgi --chdir= --
>>> module='django.core.handlers.wsgi:WSGIHandler()' --env
>>> DJANGO_SETTINGS_MODULE=myapp.settings --master --pidfile=/tmp/project-
>>> master.pid --socket=127.0.0.1:49152 --max-requests=5000 --process=5
>> 
>>> then I benchmarked the app with ab:
>> 
>>> ab -n 1000 -c 4http://127.0.0.1:80/
>>> This is ApacheBench, Version 2.3 <$Revision: 655654 $>
>>> Copyright 1996 Adam Twiss, Zeus Technology Ltd,http://www.zeustech.net/
>>> Licensed to The Apache Software Foundation,http://www.apache.org/
>> 
>>> Benchmarking 127.0.0.1 (be patient)
>>> Completed 100 requests
>>> Completed 200 requests
>>> Completed 300 requests
>>> Completed 400 requests
>>> Completed 500 requests
>>> Completed 600 requests
>>> Completed 700 requests
>>> Completed 800 requests
>>> Completed 900 requests
>>> Completed 1000 requests
>>> Finished 1000 requests
>> 
>>> Server Software:nginx
>>> Server Hostname:127.0.0.1
>>> Server Port:80
>> 
>>> Document Path:  /
>>> Document Length:24293 bytes
>> 
>>> Concurrency Level:  4
>>> Time taken for tests:   28.914 seconds
>>> Complete requests:  1000
>>> Failed requests:0
>>> Write errors:   0
>>> Total transferred:  24423000 bytes
>>> HTML transferred:   24293000 bytes
>>> Requests per second:34.59 [#/sec] (mean)
>>> Time per request:   115.654 [ms] (mean)
>>> Time per request:   28.914 [ms] (mean, across all concurrent
>>> requests)
>>> Transfer rate:  824.89 [Kbytes/sec] received
>> 
>>> Connection Times (ms)
>>>  min  mean[+/-sd] median   max
>>> Connect:00   0.1  0   4
>>> Processing:46  115  42.6110 636
>>> Waiting:   46  115  42.5109 636
>>> Total: 46  116  42.6110 636
>> 
>>> Percentage of the requests served within a certain time (ms)
>>>  50%110
>>>  66%121
>>>  75%131
>>>  80%139
>>>  90%161
>>>  95%177
>>>  98%203
>>>  99%220
>>> 100%636 (longest request)
>> 
>>> now I implemented the same app using playframework, a java based
>>> framework and benchmarked with ab again:
>> 
>>> ab -n 1000 -c 4http://127.0.0.1:9000/
>>> This is ApacheBench, Version 2.3 <$Revision: 655654 $>
>>> Copyright 1996 Adam Twiss, Zeus Technology Ltd,http://www.zeustech.net/
>>> Licensed to The Apache Software Foundation,http://www.apache.org/
>> 
>>> Benchmarking 127.0.0.1 (be patient)
>>> Completed 100 requests
>>> Completed 200 requests
>>> Completed 300 requests
>>> Completed 400 requests
>>> Completed 500 requests
>>> Completed 600 requests
>>> Completed 700 requests
>>> Completed 800 requests
>>> Completed 900 requests
>>> Completed 1000 requests
>>> Finished 1000 requests
>> 
>>> Server Software:Play!
>>> Server Hostname:127.0.0.1
>>> Server Port:9000
>> 
>>> Document Path:  /
>>> Document Length:19614 bytes
>> 
>>> Concurrency Level:  4
>>> Time taken for tests:   4.436 seconds
>>> Complete requests:  1000
>>> Failed requests:0
>>> Write errors:   0
>>> Total transferred:  19961000 bytes
>>> HTML transferred:   19614000 bytes
>>> Requests per second:225.44 [#/sec] (mean)
>>> Time per request:

Re: django/python performance vs play/java

2011-07-05 Thread Xavier Ordoquy
Hi,

Install Django debug toolbar and have a look at what's wrong with your 
application.
My numbers are very different from yours.

I just ran some tests and I am around 350 req/s with 4 sql queries.
I'm a on dual core (4 virtual cores), using gunicorn/mysql with debug turned 
off, 4 workers processes

This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 500 requests
Completed 1000 requests
Completed 1500 requests
Completed 2000 requests
Completed 2500 requests
Completed 3000 requests
Completed 3500 requests
Completed 4000 requests
Completed 4500 requests
Completed 5000 requests
Finished 5000 requests


Server Software:gunicorn/0.12.2
Server Hostname:127.0.0.1
Server Port:8088

Document Path:  /project/1/
Document Length:4327 bytes

Concurrency Level:  4
Time taken for tests:   14.041 seconds
Complete requests:  5000
Failed requests:0
Write errors:   0
Total transferred:  22405000 bytes
HTML transferred:   21635000 bytes
Requests per second:356.10 [#/sec] (mean)
Time per request:   11.233 [ms] (mean)
Time per request:   2.808 [ms] (mean, across all concurrent requests)
Transfer rate:  1558.29 [Kbytes/sec] received

Connection Times (ms)
  min  mean[+/-sd] median   max
Connect:00   0.0  0   1
Processing:10   11   3.5 11  73
Waiting:   10   11   3.5 10  73
Total: 10   11   3.5 11  73

Percentage of the requests served within a certain time (ms)
  50% 11
  66% 11
  75% 11
  80% 11
  90% 11
  95% 12
  98% 14
  99% 23
 100% 73 (longest request)



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



  1   2   3   >