DB Design question

2015-07-31 Thread jordi collell
Hi all!

I have to store spreadsheet info on a db. Some kind of quotes where the 
user can store distinct prices for every zone. 

After modeling the data, i have a Cell like row. (related to a zone, and 
with a quantity field).. something like:

zone1  1  100
zone1  2  99
zone1  3  98

Every zone is a fk... The problem is, that data grows quick.. because some 
quotes can have up to 65 unit fields with 70 to 100 zones.. 

Currently i have a autopk field. but I'm not sure if it will scale.. If i 
have 5000 users and every users makes 100 quotations.. (7000 rows on the 
worst case) this is 35.. easy enought to get out of autoincrement 
fields.. 

I'm thinking on getting rid of the pk field, and use a unique together with 
(zone_units). do you think this is a good aproach with the orm? I saw that 
is not possible to make primary key fields ( with grouped fields), but 
perhaps I can do it with instead of declaring a int field, have a char 
field storing the 
%s_%s_%s ( quote_id, zone_id, units ) ... 

do you think the last could be a good aproach? 

Sure if i have to shard the data (on the future) I can do it, using this 
kind of keys.. Data will be queryed by zone.. (For making comparasions of 
quotes)

I will apreciate any help on the matter.


-- 
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/c2a69c66-d1b8-4f08-95ed-b26fbb1d762e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


BaseListView's get_context_data is missing kwargs?

2015-08-02 Thread jordi collell
Not sure if i'm understanding what are you saying. But kwargs on get.. Are 
stored on a object property. Self.kwargs (prior the dispatch) method.

-- 
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/1956c0d6-42ff-49c8-bb01-54380b09fdae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


BaseListView's get_context_data is missing kwargs?

2015-08-02 Thread jordi collell
Not sure if i'm understanding what are you saying. But kwargs on get.. Are 
stored on a object property. Self.kwargs (prior the dispatch) method.

-- 
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/5375c024-ee41-4b46-816d-e63fadb4a720%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Restricting CreateView

2015-08-02 Thread jordi collell
I think you don't need extra packages for the task. You can overwrite the 
dispatch to validate permissions on get and post create view.

-- 
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/5af601d2-b5cb-422c-ad1c-7ea45a5b8a20%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Models.clean() how to raise ValidationError WITH error_code and show field_based errors in the Form-Template?

2015-08-02 Thread jordi collell
An easy way is to test that the rendered form has the error message raised 
suring rhe validation.

-- 
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/eef3dbd2-f0ba-4c4c-8eef-af2aee8befe4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.