Re: But I can not figure out how to write the code to add a page. Thank you so much.

2015-12-06 Thread Валерий Бовсуновский
В просто варианте получается так как, я понимаю. Модель Book и связанная с 
ней модель Pages, связанная многие к одному.

class Book(models.Model):
book = models.CharField(max_length=200)

def __unicode__(self):
return self.book

class Pages(models.Model):
connect = models.ForeignKey(Book)
pages = models.TextField(blank=True, verbose_name='Страница')



Не сходится у меня или чего то упускаю. У меня 300 пользователей.
Каждый допустим создаст книгу. 
Тогда при выбое страницы, придётся выбирать из списка с 300 книг.

Как сделать так, что бы когда пользователь при создании книги, страницы, 
которые он будет добавлять по умолчнаю уже выбирали его новую книгу.
Я так понимаю нужно это как то прописать. Как забронировать это?

Общая идея такая. Я хочу избежать личных аккаунтов пользователей.
Что бы н было блуждания по аккаунтам а всё находилось в одном месте.

Сейчас начала описывать Rest Framework дам начало и основные возможности.
Но потом хочу дать возможность, что бы когда люди научаться, то будут 
добавлять свой опыт.

Для этого.

а)
1. Создам три рубрики и свяжу их с книгами. (здесь это модели пока нет)
1. Начало работы.
2. Рецепты
3. Лучшие практики.
Здесь мне всё понятно. Добавлю ещё одну связь и человек будет выбирать из 
трёх рубрик, куда добавить свою книгу. - это мне понятно. (книги будут 
выводмится по категориям)


б) Пользователь может иметь много книг и их можно отдельно вывести. Здест 
тоже нет проблем (создам отношение к User один к одному) - это тоже понятно.

в)
Остается, только не понятно то что описал выше. Что бы при создании книги, 
страницы присоединялись именно к вновь созданной книге, без выбора из 
списка из всех книг.


воскресенье, 6 декабря 2015 г., 1:33:32 UTC+3 пользователь Sergiy Khohlov 
написал:
>
> Two models book and page. Page has key field to book . page is attached to 
> the book page as related object.
> 5 груд. 2015 17:42 "Валерий Бовсуновский" > 
> пише:
>
>> But I can not figure out how to write the code to add a page.
>>
>> Guys, please natolknite the idea. If possible, reset the reference to an 
>> example or help section.
>> I can not understand. I want to do a book on the website:
>> What would each user can create a book. (unlimited number of pages)
>> But I can not figure out how to write the code to add a page.
>> Thank you so 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...@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/f3d8d77b-4e91-4aec-819b-844e79258a14%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/ae74e0ba-a077-4246-a5ad-6b2dce3e8294%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: But I can not figure out how to write the code to add a page. Thank you so much.

2015-12-06 Thread Валерий Бовсуновский
Забыл сказать, спасибо большое Сергей за мысль. (есть над чем работать).
Просто давно пользовался moodle на php там была возможность создать 
страницу, книгу, ссылку. И я хочу нечто такое сделать.

воскресенье, 6 декабря 2015 г., 1:33:32 UTC+3 пользователь Sergiy Khohlov 
написал:
>
> Two models book and page. Page has key field to book . page is attached to 
> the book page as related object.
> 5 груд. 2015 17:42 "Валерий Бовсуновский" > 
> пише:
>
>> But I can not figure out how to write the code to add a page.
>>
>> Guys, please natolknite the idea. If possible, reset the reference to an 
>> example or help section.
>> I can not understand. I want to do a book on the website:
>> What would each user can create a book. (unlimited number of pages)
>> But I can not figure out how to write the code to add a page.
>> Thank you so 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...@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/f3d8d77b-4e91-4aec-819b-844e79258a14%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/74c5e648-e213-4c8c-8d50-629e9f44b2d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need a Tutorial

2015-12-06 Thread Derek
http://learnpythonthehardway.org/book/ is also available for free online; I 
second Andrew's recommendation of it...

On Saturday, 5 December 2015 18:43:58 UTC+2, Andrew Farrell wrote:
>
> Python tutorials: 
>   The tutorial I first learned python from was Think Python 
> , which is free to download. 
> That was several years ago and better things have been written since. 
>   I am a fan of the approach that Learn Python the Hard Way 
>  takes, but I haven't worked through 
> it extensively.
>   One thing these tutorials tend to skip over is the use of pdb 
> , which I found very useful 
> when I was first starting out and which I continue to find useful.
>
>  While I've got you, can I shamelessly-plug two other resources?
>
> Django tutorials:
>   Test-Driven development with Python 
> : I think 
> test-driven development is a great approach for beginners because it helps 
> solve the "where in the name of the FSM is the bug coming from?" problem. 
> The usual downfall is that it takes some guidance to set yourself up for 
> TDD if you are new to a language or toolset. Harry Percival does a good job 
> of providing that guidance.
>Django Unleashed 
> :
>  
> This provides both an introduction to django itself and broader context of 
> how to deploy it in production, the basics of web architecture, and some 
> reasons behind design decisions. 
>
> On Sat, Dec 5, 2015 at 9:55 AM, Mark Phillips  > wrote:
>
>> Try this - http://lmgtfy.com/?q=python+tutorial
>>
>> Mark
>>
>> On Sat, Dec 5, 2015 at 12:49 AM, Davron > > wrote:
>>
>>> HI!
>>> Could any python's gurus give me a some links,
>>> which leads to for a real comprehensive python-tutorial, Please.
>>> 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...@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/6a62be92-2cbe-4578-a66a-145850b4fed0%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAEqej2OOmrcZoMTXMcRU%2BPCDPY0WmMxVYG9nOG-UeZt0fbdG5g%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/28ca747a-e07b-416f-924d-1f838c467895%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


staticfiles ManifestStaticFilesStorage and Form Media

2015-12-06 Thread Brian Neal
I'm investigating using staticfiles ManifestStaticFilesStorage. Unless I'm 
missing something, there seems to be a hole with Django forms Media class. 
If you use an inner Media class you do not get the hashed versions of the 
assets filenames. 

This leads me to believe you can't use the Forms Media technique with 
ManifestStaticFilesStorage. 

I noticed there was an undocumented function called static in 
staticfiles.templatetags.staticfiles. I tried calling this function inside 
my inner Media classes to make it return the hashed version of the files, 
and this does work as long as collectstatic has been run. But if you have 
an empty STATIC_DIR, you can't even call the management command to run 
collectstatic as it tries to resolve these Media classes at import time. So 
it seems to be a chicken and egg problem. A possible work around was found 
on stackoverflow to delay the evaluation of the Media 
classes: 
http://stackoverflow.com/questions/28366281/django-cachedstaticfilesstorage-in-modeladmin-media

So it seems I have a couple of options:

1) Give up on form Media classes and explicitly use {% static %} in my 
templates instead of {% form.media %}
2) Defer the resolution of {% form.media %} using the stackoverflow trick

Since I'm not doing any dynamic decision making in my views about what 
forms to use (yet), I always know what static files I need in my templates 
to support my forms, so I'm leaning toward option 1. But just wanted to 
bounce this off the community in case I am missing something.

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/39a230f1-3025-4964-b543-b7d48a0798ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Problem Working with forms.Form

2015-12-06 Thread Teddy McZieuwa
Hi,
please, I am new to django, I just need to know to save to a database while 
using 'forms.Form' utility and how does it know which database model to 
use. I do not want to use the 'forms.ModelForm' because i would like to 
customize, I don't want django giving me its default style form. 
Please I really need help ASAP. Thank you.

-- 
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/b0474e0d-4cac-4b6f-8396-87208d4e0dc7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


date picker

2015-12-06 Thread Sid
Hi all,

*Problem:*
I have a data set which shows on web page using django and another webpage 
consists of datepicker


*code:(views.py)*
def about(request):
#change the file name here every month
x='2015-10-30 00:00:00.000';
table0=connection.cursor()
table0.execute('''SELECT * INTO table0 FROM MASTER_DDA WHERE 
PROCESSING_DATE= %s''',[x]);

-The above programming displays the data of  *MASTER_DDA *according to *[x] 
*for *PROCESSING_DATE ,* so what I want is I have to just click on the 
datepicker so it has to change the value of *[x] *and display accordingly 
on web page 
So can anyone please help me to built the code for it please
your help is much appreciated. Thanks again.

Sid  

-- 
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/02b9dd44-5c7e-4afc-b17c-05da2c9de72f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django-admin startproject mysite showing invalid syntax

2015-12-06 Thread Guntaka Jeevan
 i have installed django using pip from anaconda but when i type   
django-admin startproject mysite it is showing   File "", line 1 
django-admin startproject mysite ^ SyntaxError: 
invalid syntax

-- 
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/348cf71b-2fe0-4669-b32d-990e819b876e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django-admin startproject mysite showing invalid syntax

2015-12-06 Thread 'Hugo Osvaldo Barrera' via Django users

On Sun, Dec 6, 2015, at 16:09, Guntaka Jeevan wrote:
> i have installed django using pip from anaconda but when i type   django-
> admin startproject mysite it is showing   File "", line 1
> django-admin startproject mysite                             ^
> SyntaxError: invalid syntax

`django-admin` is a shell command, you should run it on your ordinary
shell, not a python shell.

> --
>
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/348cf71b-2fe0-4669-b32d-990e819b876e%40googlegroups.com[1].
>
For more options, visit https://groups.google.com/d/optout.

--
Hugo Osvaldo Barrera
 


Links:

  1. 
https://groups.google.com/d/msgid/django-users/348cf71b-2fe0-4669-b32d-990e819b876e%40googlegroups.com?utm_medium=email&utm_source=footer

-- 
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/1449430268.1344345.459612489.5E9A817D%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem Working with forms.Form

2015-12-06 Thread Gergely Polonkai
Hello,

you should use ModelForm; if the only problem you have is the CSS
properties, you may assign custom CSS classes to your widgets, and use
templates to render your fields individually.

Best,
Gergely
On Dec 6, 2015 5:33 PM, "Teddy McZieuwa"  wrote:

> Hi,
> please, I am new to django, I just need to know to save to a database
> while using 'forms.Form' utility and how does it know which database model
> to use. I do not want to use the 'forms.ModelForm' because i would like to
> customize, I don't want django giving me its default style form.
> Please I really need help ASAP. Thank you.
>
> --
> 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/b0474e0d-4cac-4b6f-8396-87208d4e0dc7%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/CACczBUKsA0M7LStkf0JLQCCkD0C9gmRd3yBMBOXv7Ox-9uzk9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: But I can not figure out how to write the code to add a page. Thank you so much.

2015-12-06 Thread Sergiy Khohlov
Nature language  of this  maillist is English.  Please keep this in mind
Take a look at the example at
https://docs.djangoproject.com/en/1.8/topics/db/queries/
 your task is subpart of the task in  documentations.

 General procedure is next :
 1) set user authorization
1a) This is not important but can be usefull : Add  to the user profile
last edited book
2)  User select  book  or use  default choice
3)  User  create a page  which is used ID (slug) of the book in constructor

 Also you url.py should looks like :

urlpatterns = [
url(r'^(?P[-\w]+)/$', PageCreateView.as_view()),]

 Where P[-\w+] is a slug field of the edited book
 or P\d+  for Key usage


Many thanks,

Serge


+380 636150445
skype: skhohlov

2015-12-06 14:39 GMT+02:00 Валерий Бовсуновский :

> В просто варианте получается так как, я понимаю. Модель Book и связанная с
> ней модель Pages, связанная многие к одному.
>
> class Book(models.Model):
> book = models.CharField(max_length=200)
>
> def __unicode__(self):
> return self.book
>
> class Pages(models.Model):
> connect = models.ForeignKey(Book)
> pages = models.TextField(blank=True, verbose_name='Страница')
>
>
>
> Не сходится у меня или чего то упускаю. У меня 300 пользователей.
> Каждый допустим создаст книгу.
> Тогда при выбое страницы, придётся выбирать из списка с 300 книг.
>
> Как сделать так, что бы когда пользователь при создании книги, страницы,
> которые он будет добавлять по умолчнаю уже выбирали его новую книгу.
> Я так понимаю нужно это как то прописать. Как забронировать это?
>
> Общая идея такая. Я хочу избежать личных аккаунтов пользователей.
> Что бы н было блуждания по аккаунтам а всё находилось в одном месте.
>
> Сейчас начала описывать Rest Framework дам начало и основные возможности.
> Но потом хочу дать возможность, что бы когда люди научаться, то будут
> добавлять свой опыт.
>
> Для этого.
>
> а)
> 1. Создам три рубрики и свяжу их с книгами. (здесь это модели пока нет)
> 1. Начало работы.
> 2. Рецепты
> 3. Лучшие практики.
> Здесь мне всё понятно. Добавлю ещё одну связь и человек будет выбирать из
> трёх рубрик, куда добавить свою книгу. - это мне понятно. (книги будут
> выводмится по категориям)
>
>
> б) Пользователь может иметь много книг и их можно отдельно вывести. Здест
> тоже нет проблем (создам отношение к User один к одному) - это тоже понятно.
>
> в)
> Остается, только не понятно то что описал выше. Что бы при создании книги,
> страницы присоединялись именно к вновь созданной книге, без выбора из
> списка из всех книг.
>
>
> воскресенье, 6 декабря 2015 г., 1:33:32 UTC+3 пользователь Sergiy Khohlov
> написал:
>>
>> Two models book and page. Page has key field to book . page is attached
>> to the book page as related object.
>> 5 груд. 2015 17:42 "Валерий Бовсуновский"  пише:
>>
>>> But I can not figure out how to write the code to add a page.
>>>
>>> Guys, please natolknite the idea. If possible, reset the reference to an
>>> example or help section.
>>> I can not understand. I want to do a book on the website:
>>> What would each user can create a book. (unlimited number of pages)
>>> But I can not figure out how to write the code to add a page.
>>> Thank you so 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...@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/f3d8d77b-4e91-4aec-819b-844e79258a14%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/ae74e0ba-a077-4246-a5ad-6b2dce3e8294%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

Drop and replace SQL Table automatically when Model is migrated

2015-12-06 Thread Alexander Whatley
This question may just be due to my inexperience with Django, but whenever 
I modify one of my Model elements and change its parameters, I have to 
close my IDE and manually use the command prompt to drop the SQL Table 
corresponding to the Model, and then migrate the new model, which is very 
annoying. Is there a built in feature in Django that allows me to get 
around having to do this, and if not, is there one in development? 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/06d9f15a-eaff-43e3-90d6-56a0b03c4e97%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: But I can not figure out how to write the code to add a page. Thank you so much.

2015-12-06 Thread Валерий Бовсуновский
Thank you very much for the plan and a link to the documentation. I used to 
work with the documentation, it is now clear what to do.

воскресенье, 6 декабря 2015 г., 23:03:42 UTC+3 пользователь Sergiy Khohlov 
написал:
>
> Nature language  of this  maillist is English.  Please keep this in mind
> Take a look at the example at 
> https://docs.djangoproject.com/en/1.8/topics/db/queries/
>  your task is subpart of the task in  documentations.
>
>  General procedure is next : 
>  1) set user authorization
> 1a) This is not important but can be usefull : Add  to the user profile 
> last edited book 
> 2)  User select  book  or use  default choice
> 3)  User  create a page  which is used ID (slug) of the book in 
> constructor 
>
>  Also you url.py should looks like : 
>
> urlpatterns = [
> url(r'^(?P[-\w]+)/$', PageCreateView.as_view()),]
>
>  Where P[-\w+] is a slug field of the edited book 
>  or P\d+  for Key usage 
>
>
> Many thanks,
>
> Serge
>
>
> +380 636150445
> skype: skhohlov
>
> 2015-12-06 14:39 GMT+02:00 Валерий Бовсуновский  >:
>
>> В просто варианте получается так как, я понимаю. Модель Book и связанная 
>> с ней модель Pages, связанная многие к одному.
>>
>> class Book(models.Model):
>> book = models.CharField(max_length=200)
>>
>> def __unicode__(self):
>> return self.book
>>
>> class Pages(models.Model):
>> connect = models.ForeignKey(Book)
>> pages = models.TextField(blank=True, verbose_name='Страница')
>>
>>
>>
>> Не сходится у меня или чего то упускаю. У меня 300 пользователей.
>> Каждый допустим создаст книгу. 
>> Тогда при выбое страницы, придётся выбирать из списка с 300 книг.
>>
>> Как сделать так, что бы когда пользователь при создании книги, страницы, 
>> которые он будет добавлять по умолчнаю уже выбирали его новую книгу.
>> Я так понимаю нужно это как то прописать. Как забронировать это?
>>
>> Общая идея такая. Я хочу избежать личных аккаунтов пользователей.
>> Что бы н было блуждания по аккаунтам а всё находилось в одном месте.
>>
>> Сейчас начала описывать Rest Framework дам начало и основные возможности.
>> Но потом хочу дать возможность, что бы когда люди научаться, то будут 
>> добавлять свой опыт.
>>
>> Для этого.
>>
>> а)
>> 1. Создам три рубрики и свяжу их с книгами. (здесь это модели пока нет)
>> 1. Начало работы.
>> 2. Рецепты
>> 3. Лучшие практики.
>> Здесь мне всё понятно. Добавлю ещё одну связь и человек будет выбирать из 
>> трёх рубрик, куда добавить свою книгу. - это мне понятно. (книги будут 
>> выводмится по категориям)
>>
>>
>> б) Пользователь может иметь много книг и их можно отдельно вывести. Здест 
>> тоже нет проблем (создам отношение к User один к одному) - это тоже понятно.
>>
>> в)
>> Остается, только не понятно то что описал выше. Что бы при создании 
>> книги, страницы присоединялись именно к вновь созданной книге, без выбора 
>> из списка из всех книг.
>>
>>
>> воскресенье, 6 декабря 2015 г., 1:33:32 UTC+3 пользователь Sergiy Khohlov 
>> написал:
>>>
>>> Two models book and page. Page has key field to book . page is attached 
>>> to the book page as related object.
>>> 5 груд. 2015 17:42 "Валерий Бовсуновский"  пише:
>>>
 But I can not figure out how to write the code to add a page.

 Guys, please natolknite the idea. If possible, reset the reference to 
 an example or help section.
 I can not understand. I want to do a book on the website:
 What would each user can create a book. (unlimited number of pages)
 But I can not figure out how to write the code to add a page.
 Thank you so 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...@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/f3d8d77b-4e91-4aec-819b-844e79258a14%40googlegroups.com
  
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/ae74e0ba-a077-4246-a5ad-6b2dce3e8294%40googlegroups.com
>>  
>> 

Django

2015-12-06 Thread Vinod Jat
i am new in django. i have installed django but i got errors about 
configuring please help

-- 
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/85c21fbc-634f-4d2a-9a56-f51a159894d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django

2015-12-06 Thread sum abiut
what error message are you getting?
cheers

On Mon, Dec 7, 2015 at 8:01 AM, Vinod Jat  wrote:

> i am new in django. i have installed django but i got errors about
> configuring please help
>
> --
> 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/85c21fbc-634f-4d2a-9a56-f51a159894d4%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/CAPCf-y7c0gpkfRpRykd3sUs8KB85xjyRFj2L2o9jm5L8KudGQw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Windows browser vs Django app running on Ubuntu in a VirtualBox

2015-12-06 Thread bobhaugen
Remco, thanks a lot for the response, and your answer makes sense to me. 
Unfortunately, I am not Chris, and I do not have a Windows box, so I need 
to wait until he gets time to try it out to validate it. But when he 
responds, I will, This is just to thank you for your answer and let you 
know that a proper response will be forthcoming.

On Saturday, December 5, 2015 at 4:10:17 PM UTC-6, Remco Gerlich wrote:
>
> He is running it with "./manage.py runserver", which listens to the local 
> interface only (the 127.0.0.1 IP address).
>
> To get it to listen to the external address instead, use "./manage.py 
> runserver 192.168.56.101:8000" and then it will work. Or "0.0.0.0:8000" 
> to listen to all interfaces.
>
> Greetings,
> Remco Gerlich
>
> On Sat, Dec 5, 2015 at 10:07 PM, bobhaugen  > wrote:
>
>> Our friend Chris Troutner installed our Django 1.4 app on Windows  in 
>> a VirtualBox running Ubuntu.
>>
>> He could access the Django app from the browser in Ubuntu, but not from 
>> the Windows browser.
>>
>> He writes:
>>
>>- While you can access the front end in the Ubuntu VM, you can't 
>>access it from the windows desktop. You should be able to by pointing 
>> your 
>>Windows browser at http://192.168.56.101:8000, but that didn't work 
>>for me. 192.168.56.101 was the IP address Virtual Box assigned to its 
>>Host-Adapter. I can ping that address and SSH to it, but I can't bring up 
>>Django.
>>
>>This is most likely a simple fix with the network settings, but as of 
>>this writing, I haven't figured out a fix yet.
>>
>> Here's his whole story: 
>> http://christroutner.com/blog/post/open-value-networks
>>
>> Anybody got any ideas so he can finish the story? 
>> Thanks for any help you can offer.
>>
>> -- 
>> 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/3cc31a21-fd27-4f3f-a4a7-767a028b72b5%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/699c00d5-536f-4b3c-9b4a-875e06db6c44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Drop and replace SQL Table automatically when Model is migrated

2015-12-06 Thread Mike Dewhirst

On 7/12/2015 7:21 AM, Alexander Whatley wrote:

This question may just be due to my inexperience with Django, but
whenever I modify one of my Model elements and change its parameters, I
have to close my IDE and manually use the command prompt to drop the SQL
Table corresponding to the Model, and then migrate the new model, which
is very annoying.


It sounds like this is a feature your IDE should provide. Django has the 
necessary functionality but won't do it unbidden.



Is there a built in feature in Django that allows me

to get around having to do this, and if not, is there one in
development? 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/06d9f15a-eaff-43e3-90d6-56a0b03c4e97%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/5664D756.1090909%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Drop and replace SQL Table automatically when Model is migrated

2015-12-06 Thread James Schneider
On Dec 6, 2015 4:48 PM, "Mike Dewhirst"  wrote:
>
> On 7/12/2015 7:21 AM, Alexander Whatley wrote:
>>
>> This question may just be due to my inexperience with Django, but
>> whenever I modify one of my Model elements and change its parameters, I
>> have to close my IDE and manually use the command prompt to drop the SQL
>> Table corresponding to the Model, and then migrate the new model, which
>> is very annoying.
>

Are you creating a new migration after each set of changes and then
applying that new migration? Why is it that you are expecting a table to
drop when all you are doing is modifying an existing table/model? If that's
the case, the existing table would be altered, not dropped and recreated
with the new attributes (which would cause a loss of data and likely other
issues with related data).

If the standard migration process is not working, you should post up the
errors that you are getting. Your IDE should have little to do with this
process, aside from maybe triggering the migration scripts to run if it
supports such an operation.

>
> It sounds like this is a feature your IDE should provide. Django has the
necessary functionality but won't do it unbidden.
>
>
>
> Is there a built in feature in Django that allows me
>>
>> to get around having to do this, and if not, is there one in
>> development? Thanks.
>>

If you are expecting (well, desiring) this behavior, you'll likely need to
write your own management command to perform this task, which is pretty
simple. I wrote one that does something similar to what you are expecting,
except that it drops the entire database, creates a new one, applies all
existing migrations, and then populates the DB with dummy data that I've
generated (since I'm working on models that expect that data to be present
already and its a pain to manually create it via the web browser every
time). Think of an online demo of an application that resets itself every
hour.

https://docs.djangoproject.com/en/1.9/howto/custom-management-commands/

I do think a built-in admin command to "reset" the entire database would be
handy, but I've been too lazy to put in the feature request.

-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 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%2BciXohddFptGwZxy%2B24AmYJqA2Ej6_3mv_pn%3Dmx%3DwbZ4m3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Drop and replace SQL Table automatically when Model is migrated

2015-12-06 Thread Alexander Whatley
I will check with the people who made the IDE. Thanks for the input.

On Sunday, December 6, 2015 at 3:22:50 PM UTC-5, Alexander Whatley wrote:
>
> This question may just be due to my inexperience with Django, but whenever 
> I modify one of my Model elements and change its parameters, I have to 
> close my IDE and manually use the command prompt to drop the SQL Table 
> corresponding to the Model, and then migrate the new model, which is very 
> annoying. Is there a built in feature in Django that allows me to get 
> around having to do this, and if not, is there one in development? 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/b39603db-175d-42ac-a607-229a961788c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem Working with forms.Form

2015-12-06 Thread sum abiut
You can use modelForm.

for example in you form.py file, you can do something like this:

class addstaff(forms.ModelForm):
class Meta:
model =new_staff
fields =('first_name', 'last_name', 'gender', 'date_of_birth')


and in your view.py you do something like this:

def newstaff(request):
if request.POST:
form =addstaff(request.POST)
if form.is_valid():
form.save()
return render_to_response("successful.html")
else:
form =addstaff
args={}
args.update(csrf(request))
args['form']=form
return render_to_response('addnewstaff.html', args)





Cheers





On Mon, Dec 7, 2015 at 6:54 AM, Gergely Polonkai 
wrote:

> Hello,
>
> you should use ModelForm; if the only problem you have is the CSS
> properties, you may assign custom CSS classes to your widgets, and use
> templates to render your fields individually.
>
> Best,
> Gergely
> On Dec 6, 2015 5:33 PM, "Teddy McZieuwa"  wrote:
>
>> Hi,
>> please, I am new to django, I just need to know to save to a database
>> while using 'forms.Form' utility and how does it know which database model
>> to use. I do not want to use the 'forms.ModelForm' because i would like to
>> customize, I don't want django giving me its default style form.
>> Please I really need help ASAP. Thank you.
>>
>> --
>> 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/b0474e0d-4cac-4b6f-8396-87208d4e0dc7%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/CACczBUKsA0M7LStkf0JLQCCkD0C9gmRd3yBMBOXv7Ox-9uzk9w%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/CAPCf-y7Lp6P5qMDk-ENM-fyZcYy272BV2dMSp511ybxO2dziXw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: staticfiles ManifestStaticFilesStorage and Form Media

2015-12-06 Thread Denis Cornehl
Hi Brian, 

a sidenote, this will be fixed: 
https://github.com/django/django/pull/5571


-- 
Denis


Am Sonntag, 6. Dezember 2015 um 17:17 schrieb Brian Neal:

> I'm investigating using staticfiles ManifestStaticFilesStorage. Unless I'm 
> missing something, there seems to be a hole with Django forms Media class. If 
> you use an inner Media class you do not get the hashed versions of the assets 
> filenames. 
> 
> This leads me to believe you can't use the Forms Media technique with 
> ManifestStaticFilesStorage. 
> 
> I noticed there was an undocumented function called static in 
> staticfiles.templatetags.staticfiles. I tried calling this function inside my 
> inner Media classes to make it return the hashed version of the files, and 
> this does work as long as collectstatic has been run. But if you have an 
> empty STATIC_DIR, you can't even call the management command to run 
> collectstatic as it tries to resolve these Media classes at import time. So 
> it seems to be a chicken and egg problem. A possible work around was found on 
> stackoverflow to delay the evaluation of the Media classes: 
> http://stackoverflow.com/questions/28366281/django-cachedstaticfilesstorage-in-modeladmin-media
> 
> So it seems I have a couple of options:
> 
> 1) Give up on form Media classes and explicitly use {% static %} in my 
> templates instead of {% form.media %}
> 2) Defer the resolution of {% form.media %} using the stackoverflow trick
> 
> Since I'm not doing any dynamic decision making in my views about what forms 
> to use (yet), I always know what static files I need in my templates to 
> support my forms, so I'm leaning toward option 1. But just wanted to bounce 
> this off the community in case I am missing something.
> 
> 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 
> (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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/39a230f1-3025-4964-b543-b7d48a0798ab%40googlegroups.com
>  
> (https://groups.google.com/d/msgid/django-users/39a230f1-3025-4964-b543-b7d48a0798ab%40googlegroups.com?utm_medium=email&utm_source=footer).
> 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/959931F98A184A0EAEB13881D0FBD80F%40fastmail.fm.
For more options, visit https://groups.google.com/d/optout.