Question about squashing django migrations

2015-08-01 Thread Richard Brockie
Hi everyone,

Can someone please explain the implications of this note about squashing 
migrations in the documentation?

From: https://docs.djangoproject.com/en/1.7/topics/migrations/

"Once you’ve squashed a migration, you should not then re-squash that 
> squashed migration until you have fully transitioned it to a normal 
> migration."


 Is there a transition command to convert a squashed migration into a 
normal migration, or how should I go about this?

Here is my current migration situation:

Migrations:

   - 0001_initial.py
   - ...
   - 0052_auto_20150711_1407.py

have been squashed into:

   - 0001_squashed_0052_auto_20150711_1407.py

Since then, I have created further migrations:

   - 0002_auto_20150731_0651.py
   - 0003_auto_20150731_0659.py

I was a little surprised that the numbering continued from 0002 and not 
0053. I am concerned that I will become confused with the overlapping 
numbering before/after the squash so I would like to streamline things a 
little. I'm ok to remove the first set of migrations 0001 to 0052 as they 
are correctly captured by the first squash. 

What are your recommendations in a case like this?

Thanks!
Richard Brockie



-- 
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/36250ba9-e077-48c9-b92c-6ca45f983400%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Speedy Mail Software

2015-08-01 Thread Avraham Serour
my first contribution is: don't use sourceforge, use anything else

On Sat, Aug 1, 2015 at 4:20 PM, Abdulhakim Haliru 
wrote:

> Interesting. I have once contemplated building a webmail software that
> reads emails so customers don't lose emails upon switching webhosts. Hence,
> your Speedy Mail Software interests me. I'd love to be a part of the team.
>
> Great idea it's.
>
> Regards.
> Abdulhakim
>
> --
> 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/1eb6823e-387d-4731-9e98-9550dc55300c%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/CAFWa6tLmVap2amAep5wdwXDOh%2BF6vV%2Bck_9NGX%3Dj%2BBH4TedQoQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Newbie: Saving User and UserProfle from same template

2015-08-01 Thread sarfaraz ahmed
Hello Team,

I have extending the user with userprofile. I want to change first_name, 
last_name and sex from userprofile using one template. I have defined form 
and models. Please hellp this is code for edit_user view, model for user 
profile and model forms code

---

class UserProfile(models.Model):

user = models.OneToOneField(User)
activation_key = models.CharField(max_length=40,blank=True)
sex = models.CharField(max_length=6, choices=(
('male', 'Male'),
('female', 'Female'),))
key_expires = models.DateTimeField(default=datetime.date.today())
  
def __str__(self):
return self.user.username

class Meta:
verbose_name_plural=u'User profiles'
---
class UserProfileForm(forms.ModelForm):
class Meta:
   model=User
   fields =('first_name','last_name')

class UserProfileForm1(forms.ModelForm):
class Meta:
   model=UserProfile
   fields=('sex',)

--
def edit_user(request):
args={}
if request.method=="POST":
form=UserProfileForm(request.POST, instance=request.user)

if form.is_valid():
form.save()
form1=UserProfileForm1(request.POST, instance=request.user)
if form1.is_valid():
form1.save()
UserProfile.save()
return HttpResponseRedirect('/useraccount/edit_user')
else:
form=UserProfileForm()
form1=UserProfileForm1()

args['form']=form
args['form1']=form1

return render(request,'useraccount/edit_user.html',args)

Now the i go to edit user view it load blank and do nothing when I click on 
save. Please help

Regards,
Sarfaraz Ahmed

-- 
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/74aaaff7-eec5-4564-a6e3-36c325b8e859%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: settings.py TEMPLATES DIRS

2015-08-01 Thread Gary Roach
Thank you very much. I looked at that code for hours and didn't see the 
missing ) . A different set of eyes are really helpful.

Gary R

On Friday, July 31, 2015 at 11:59:38 PM UTC-7, Gary Roach wrote:
>
> Hi
>
> I'm using Django 1.8 and python 2-7 on a Debian Linux system. I am using 
> Ninja-ide as my ide. When I enter the following in the TEMPLATES section 
> the settings.py file I get an invalid syntax error:
>
> 'DIRS': [os.path.join(BASE_DIR, 'templates'],
>
>
> Since the DIRS entry is directly out of a tutorial I'm not sure what the 
> problem implys.
>
>
> Any help will be sincerely appreciated.
>
>
> Gary R
>
>

-- 
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/3432a316-0e91-4f01-9c11-d33e0dd8ab7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: DB Design question

2015-08-01 Thread Javier Guerra Giraldez
On Sat, Aug 1, 2015 at 4:53 AM, James Schneider  wrote:
> If you are talking about potentially having enough rows to extend past the
> AutoPK limits, you should consider instead using a UUID field as the PK:

note that this is only good advice if your DB handles it natively.  if
not, Django will use a charField to store it and constantly
encode-decode it.  If you're using PosgreSQL, then yes, UUID is great;
on MySQL, then it's far more efficient to use a BigInteger.  2^64
records still is far more than what you can store in the biggest
storage you can get.


-- 
Javier

-- 
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/CAFkDaoRzx3m%2B4rYuppJw_hWtt552tVG769B67RuOj8EdJCrQsg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Speedy Mail Software

2015-08-01 Thread Abdulhakim Haliru
Interesting. I have once contemplated building a webmail software that reads 
emails so customers don't lose emails upon switching webhosts. Hence, your 
Speedy Mail Software interests me. I'd love to be a part of the team.

Great idea it's. 

Regards.
Abdulhakim

-- 
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/1eb6823e-387d-4731-9e98-9550dc55300c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Speedy Mail Software

2015-08-01 Thread Uri Even-Chen
To Django users,

I'm interested in creating a new webmail platform based on Python and
Django (with jQuery and JavaScript), which will be free software & open
source - Speedy Mail Software. I created a project called Speedy Mail
Software  on
sourceforge, and I'm looking for people who will participate in writing
code for this project. I renamed the project to Speedy Mail Software
because Speedy Mail will be the webmail itself, based on Speedy Mail
Software but with a domain and a mail server(s), so people will able to
create an account there and use the mail services of the website. I'm also
trying to convince computer science students from the college I graduated
(The academic college of Tel Aviv - Yaffo) to participate in this project.

I also have another idea - I want to create a Python Web Toolkit, which
will be similar to Google Web Toolkit - people will write code in Python,
and it will run on the server side, and on the client side with JavaScript
(it will compile Python code to JavaScript, like Google Web Toolkit from
Java to JavaScript). Please let me know if you want to participate in any
of these projects (I can also create a project for the second project in
sourceforge if there will be developers interested). I will also try to ask
in the main Python list (python-l...@python.org), let me know if there is
any other relevant list.

Thanks,
Uri.

*Uri Even-Chen*   [image: photo] Phone: +972-54-3995700
Email: u...@speedy.net
Website: http://www.speedysoftware.com/uri/en/
  
    
> Speedypedia in Hebrew and English


-- 
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/CAMQ2MsEbHDbi42AhNBweZOH14zNfP4fBi2HPLMuvk1ZMmJPJeQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: DB Design question

2015-08-01 Thread James Schneider
If you are talking about potentially having enough rows to extend past the
AutoPK limits, you should consider instead using a UUID field as the PK:

https://docs.djangoproject.com/en/1.8/ref/models/fields/#uuidfield

The example in the docs uses UUID4. They index nicely and there are 2^128
(~3.4 x 10^38) UUID's available, the same as the total number of IPv6
addresses available. You'll run out of database resources (HDD, RAM, CPU)
and more importantly lifespan before running out of UUID's. I've seen some
larger DB applications use UUID's exclusively as their PK's for all tables.

Trying to merge fields to create uniqueness is difficult to do, wastes CPU,
can be buggy if fields are missing, etc., and probably doesn't index as
well.

If possible, I would also start thinking about a pruning/archiving strategy
to keep your main tables as lean as possible. With a couple billion rows,
you may see a bit of a stutter on queries. ;-D

-James


On Sat, Aug 1, 2015 at 1:56 AM, Stephen J. Butler 
wrote:

> Why not use a BigIntegerField?
>
> On Sat, Aug 1, 2015 at 12:06 AM, jordi collell  wrote:
>
>> 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.
>>
>
> --
> 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/CAD4ANxW3K2eA1pQ2L%3DZ3kJyooTjhpL1t6OzFF0r7KSY8Rvz5bQ%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVJnqd5XUP%3DS4aLwC9hyB6a%3Du8iKZftU7-RB9cCsK5VAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: DB Design question

2015-08-01 Thread Stephen J. Butler
Why not use a BigIntegerField?

On Sat, Aug 1, 2015 at 12:06 AM, jordi collell  wrote:

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

-- 
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/CAD4ANxW3K2eA1pQ2L%3DZ3kJyooTjhpL1t6OzFF0r7KSY8Rvz5bQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: settings.py TEMPLATES DIRS

2015-08-01 Thread James Schneider
You're missing a closing ) after 'templates'...

-James
On Jul 31, 2015 11:59 PM, "Gary Roach"  wrote:

> Hi
>
> I'm using Django 1.8 and python 2-7 on a Debian Linux system. I am using
> Ninja-ide as my ide. When I enter the following in the TEMPLATES section
> the settings.py file I get an invalid syntax error:
>
> 'DIRS': [os.path.join(BASE_DIR, 'templates'],
>
>
> Since the DIRS entry is directly out of a tutorial I'm not sure what the
> problem implys.
>
>
> Any help will be sincerely appreciated.
>
>
> Gary R
>
> --
> 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/35d35abb-d5d2-4108-b66e-0456e4324584%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/CA%2Be%2BciXBTe9FqA9nSEXdUyL_QbKDDPyE%3DbOECsQ2xCs76u6VqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


DB Design question

2015-08-01 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.


Re: Re. My Django Book.

2015-08-01 Thread Gary Roach
Since I am grinding my way through the learning process right now I thing I 
have some fairly pithy comments to contribute. It seems that no two 
tutorials do things the same way. I got bogged down in Two  Scoops because 
I needed a more detailed cookbook approach. Tango With Django is the best 
except it is written for Django 1.7. There is a serious break between how 
1.7 and 1.8 handle template files in the settings.py file. I still haven't 
recovered from this. Initial setup made me pull my hair out by the roots 
(and I can't afford to loose much more). Some suggestions:
  If your using a database other than the built in SQLite set it up 
first.
  Setup virtualenv and virtualenvmapper next.
  Do everything else inside of virtualenv.
  Install Django with pip (virtualenv active)
Then start a tutorial. The Django documentations tutorial seemed to be very 
good until it segued into a long trites on API setup. Really annoying. I 
just wanted to get the basic system set up. That said, the official 
tutorial may still be your best bet. Good luck.

Gary R 


On Thursday, July 30, 2015 at 1:35:16 PM UTC-7, Steve Burrus wrote:
>
> * Say I was wondering if anyone else has ever read this particulkar Django 
> book called "Sams Teach Yourself Django in 24 Hours" I checked out of the 
> library yesterday? [yeah I know it's one of the "24 hours" series] Does it 
> really teach the beginner a lot of things concerning Django?*
>
>
>
>

-- 
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/5f6624d8-d7f5-47a5-9088-b528b16bbe7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


settings.py TEMPLATES DIRS

2015-08-01 Thread Gary Roach
Hi

I'm using Django 1.8 and python 2-7 on a Debian Linux system. I am using 
Ninja-ide as my ide. When I enter the following in the TEMPLATES section 
the settings.py file I get an invalid syntax error:

'DIRS': [os.path.join(BASE_DIR, 'templates'],


Since the DIRS entry is directly out of a tutorial I'm not sure what the 
problem implys.


Any help will be sincerely appreciated.


Gary R

-- 
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/35d35abb-d5d2-4108-b66e-0456e4324584%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.