django query, order results such that th128 > th99

2015-09-27 Thread gintare
Is it possible to order the query result strings in such a way that th128 
string would be first comparing to th99.
The query results contains 128 items in format: "th"+number. For instance, 
th1, th2, ...th80, ..th99, th100, th128.
Than i order results, they go in the following order, th1, th10,th100, 
th101,th102,... th11,th110, ... th2, th20, th21,th22,.. th9,..th99.
Thus i am not able to get the largest result, which is th128. I am getting 
th99 instead.

def temp(request):
query = request.GET.get( 'q','')
#a=Aref5.objects.filter(Rname__contains='book').count()  #finds128

a=Aref5.objects.filter(Rname__contains='book').order_by('-Rname')[0:1].get() 
#gets aref5 object
print(a.Rname) #prints th99 instead of th128, which logically is larger
return render_to_response('Ath.html', {"query": query})

-- 
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/69e26bab-210e-4137-adf3-498855d0eae6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


NameError name 'lang' is not defined, corresponds to name 'polls' is not defined,

2014-07-06 Thread gintare
I am trying to create a project "lang" according Django documentation part 
1-4 tutorial.

Folder structure:

Scripts\lang\lang\_init_.py
Scripts\lang\lang\settings.py
Scripts\lang\lang\urls.py

Scripts\lang\langu\_init_.py
Scripts\lang\langu\admin.py
Scripts\lang\langu\models.py
Scripts\lang\langu\urlsu.py
Scripts\lang\langu\views.py

* Scripts\lang\lang\urls.py
from django.conf.urls import patterns, include, url

from django.contrib import admin
admin.autodiscover()

from langu import views

urlpatterns = patterns('',   
url(r'^langu/', include(langu.urlsu)),
url(r'^admin/', include(admin.site.urls)),
)


* Scripts\lang\langu\urlsu.py
from django.conf.urls import patterns, url

from langu import views

urlpatterns = patterns('',
url(r'^$', views.index, name='index')
)


* Scripts\lang\lang\settings.py
... 
INSTALLED_APPS = (
'django.contrib.admin',
'langu',
)
ROOT_URLCONF = 'lang.urls'





* Scripts\lang\langu\views.py
from django.shortcuts import render
from django.http import HttpResponse

def index(request):
return HttpResponse("Hello, world. You're at the poll index.")


-- 
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/7e9d6515-aa6b-402a-a540-c9bf4201f33f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


not able to create a site, instead text document pops out.

2013-05-10 Thread gintare
 
 Windows7 computer.
Django 1.5.1
Python 2.7
 
Not able to create a site, instead text document pops out.
Command:
 c:\Python27\Scripts>c:\Python27\Scripts\django-admin.py startproject mysite
 
does not create folder 'mysite', instead  (as any other commands like 
version, help..)
commnad gives a tetx documents poping out with text contents:
 
#!c:\Python27\python.exe
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
 
 
 
 

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




deleting my old messages

2011-12-02 Thread gintare
Hello,

Could you please delete all my posts. I look through them and copied
all needed information. I am not able to find the new questions among
old messages. After deletion the search with my name as a keyword will
give me the latest questions.

regards,
gintare statkute

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



Admin, Save

2011-11-29 Thread gintare


I am not able to save changes through Admin page in the model
instance.

The Admin page has such levels:

Project>> Model >> Model Instance.
The option save is at Model and Model Instance levels.

I can save changes only in the last Model Instance level.

I would like to be able to save changes at Model level, where i can
edit tens of Instances and later press 'Save' for all of them.

Maybe it is a bug, since the button "save exists", but it is not
working.

regards,
gintare statkute

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



after making one choice in the list, the model instance would know about this and would offer certain kind of chices2.

2011-11-28 Thread gintare

I would like to have interactive initialization in admin site.

I mean that after making one choice in the list, the model instance
would know about this and would offer certain kind of chices2.
I e, if i make choice1 books, i would get list of the books in the
choice2,
 if i make choice1 institutions, i would get list of the institutions
in the choice2.

How to implement such choices?

regards,
gintare statkute

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



python, django, regex, θæŋkfəli

2011-11-21 Thread gintare
This is corrected question. The first time it was submitted on
2011.11.22 nd.

I am not able to save string with special characters, such as θæŋ
after re.search(string).
#saving to the model Textfield does not work. Instead of θæŋkfəli, i
am getting shown "\xce\xb8\xc3\xa6\xc5\x8bkf\xc9\x99li" in Admin page.
Is it error in re.search?
Should i use special parameters during model field saving or in Admin
entry displaying?

[code]
lines='title="Listen to audio" />/ˈθæŋkfəli/ adverb' #the
string which i wan to save exactly as it is, Django saves it correctly

liness=smart_str(lines, encoding='utf-8', strings_only=False,
errors='replace') # saves correctly, i mean in Admin page in Textfield
i can read "θæŋ" characters
linesu=smart_unicode(lines, encoding='utf-8', strings_only=False,
errors='replace')  # saves correctly[/code]

## ***AFTER TRYING TO SEARCH part of unicode string linesu for
θæŋkfəli Django does not save it in needed special characters.
Instead of θæŋkfəli, i am getting "\xce\xb8\xc3\xa6\xc5\x8bkf
\xc9\x99li"  or "\u03b8\xe6\u014bkf\u0259li", Below there are shown 3
trials to get correct text and also described error in searching
liness= bytes string***

[code]stryc=re.compile('\s*/\s*(?P. .*)', re.DOTALL)
#\s+/\s+\s+[\\a-zA-Z0-9\s]
+/\s+ '
strys=re.search(stryc, linesu)[/code]

1)
[code]Pronun=stryWordcs.groups('Pronun')
a=Pronunciation(field=Pronun)
a.save()
# Pronun=  "θæŋkfəli"  [/code]

#saving to the model Textfield does not work. Instead of θæŋkfəli, i
am getting  "\u03b8\xe6\u014bkf\u0259li"

2)
[code]Pronun=stryWordcs.groups('Pronun')
Pronun=smart_str(Pronun, encoding='utf-8', strings_only=False,
errors='replace')
a=Pronunciation(field=Pronun)
a.save()[/code]

#saving to the model Textfield does not work. Instead of θæŋkfəli, i
am getting \xce\xb8\xc3\xa6\xc5\x8bkf\xc9\x99li"

3)
[code]Pronun=stryWordcs.groups('Pronun')
Pronun=Pronun.encode()
a=Pronunciation(field=Pronun)
a.save() [/code]
#saving to the model Textfield does not work. Instead of θæŋkfəli, i
am getting \xce\xb8\xc3\xa6\xc5\x8bkf\xc9\x99li"

## ***
# 4) if i try to search in lines or liness i am not able to find
θæŋkfəli due coding error about special character  ˈ (small stick on
top =\xcb\x88 = \u02c8) . Thus i make search on unicode string.

-- 
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: output as input *.html

2011-04-10 Thread gintare
I mean maybe there is some special function in Django
which display any model field as input field  in *.html.

I mean instead of generating simple text in *.html
{{ model.fieldValue_which_is_displayed_as_text }}
generates editable *.html
[[  
model.fieldValue_which_is_possible_to_edit_and_is_saved_BACK_automatically_to_model
 ]]


On Feb 10, 8:21 am, gintare  wrote:
> Now if i ^filter out and display model objects they come as a text
> information.
> I can only read it. It is not possible to make and save changes
> directly in *.html.
>
> Maybe there is some function which i overlooked by reading
> documentation, which displays model fields as input with initial
> values from database.
>
> This is possible in admine site.
> Maybe it is also possible in custom template.
>
> Now i am using plain html syntax an tag dictionaries to assign name
> and value for radio, check boxes, text areas, buttons...

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



ogg, audio,

2011-04-09 Thread gintare
How i should inlude *.ogg files to *.html with Django.

I tried without model,
directly loud file from  (from the same folder where exists Gre.html)
"Fin/templates" in Gre.html .


  http://127.0.0.1:8000/fin.ogg"; type="audio/ogg" />


OR


  


OR


  


OR


  



In Opera 11 audio play icon appears in all cases, nevertheless it do
not play the file.
Other browsers on my computer  do not support html5.
Of course file works if i check in VCL player.

regards,
gintare

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



model field assignment

2011-04-08 Thread gintare
I would like to remove multiplicative items in several fields of the
model.
I do not know how to save changes:

 for Lists in [a.SynGREn, a.SynGREnn]:
...
.. make changes in field by editing Lists, i.e. cropping part of
text: changed_text=crop(Lists, words)
...Lists=changed_text
... a.save()

HOW to save these changes to model back?
#  a.save() does save changes  for model field a.SynGREn ,
a.SynGREnn


#Suppose threre is a model GRE, with Char fieldsSynGREn,
SynGREnn

for Lists in [a.SynGREn, a.SynGREnn]:
strc=''
List=Lists.split(',')
for item in List:
if (len(item)!=0):
searchs='\s+'+item+'\s+'
if ( re.search(searchs, strc)==None ):
strc=strc+', '+item+' '
Lists=strc
a.save();
#saves changes only for variable Lists, not for model field a.SynGREn
or a.SynGREnn

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



output as input *.html

2011-02-09 Thread gintare
Now if i filter out and display model objects they come as a text
information.
I can only read it. It is not possible to make and save changes
directly in *.html.


Maybe there is some function which i overlooked by reading
documentation, which displays model fields as input with initial
values from database.

This is possible in admine site.
Maybe it is also possible in custom template.

Now i am using plain html syntax an tag dictionaries to assign name
and value for radio, check boxes, text areas, buttons...

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



where is a mistake in radio buttons

2011-02-08 Thread gintare

*.html


{% csrf_token %}


starts
ends
contains
equal


''''''''''''''''''''''''#
views.py

rstartsLkIn, rendsLkIn, rcontainsLkIn, requalLkIn =
request.POST.get('rstartsLkIn','')  ,
request.POST.get('rendsLkIn','')  ,
request.POST.get('rcontainsLkIn','')  ,
request.POST.get('requalLkIn','')

 if (rcontainsLkIn)... gives none  although it is already preselected
initially.

How i should read value from radio buttons?
Check-boxes works perfectly.

regards,
gintare




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



answer to question related about the *.html filling with values

2011-02-06 Thread gintare
it is incredibly easy, just difficult to guess out without example.

*.html



{{Output}}  

#

views.py

def web(request):
Out, Ww =request.GET.get('Output',''), request.GET.get('sWw','')

Out='naujas zodis'
sWw= 'off'
t = loader.get_template('c:/Python27/Scripts/Spokas/web.html')
c = Context({
'Output': Out,
})

return HttpResponse(t.render(c))

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



population of *.html fields from Django

2011-02-06 Thread gintare
I would like to use only plain html field names
Reading them is not a problem with request in views.
How to populate html document back ?


I have *.html with lines:


 
 
 

#in views.py
item = request.POST.get('cbnWw','')
#do smth with item
#now i would like to return item back to html.
#Normally i should use {{ }} for variable output.
#IS IT POSSIBLE TO USE HTML SYNTAX  and populate textarea and
checkboxes

 return render_to_response('x.html',{ 'LangFROMt', 'EN'}, 


?
regards,
gintare

-- 
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: different length queries

2011-02-06 Thread gintare
Thanks a lot for the answers!
I did not found that it is possible to use dictionaries and lists in
query.
In the end i used raw function to form string according form input.
Lists and Dictionaries is much better way, since i am not tied to
certain database.

regards,
gintare

On Feb 3, 12:08 pm, Tom Evans  wrote:
> On Thu, Feb 3, 2011 at 9:51 AM,gintare wrote:
>
> > answer to my previous question about different length queries
> >http://docs.djangoproject.com/en/dev/topics/db/sql/
> > #for p in Person.objects.raw('SELECT * FROM myapp_person')
>
> > Is it possible to post all the question which i send immediately?
> > Sometimes i find answer by myself.
>
> > I also soon would like to be able to delete all my posts and put
> > instead one summary post with main issues i met during self learning
> > from manuals.
>
> Typically people look for the answer first, before asking for help, so
> as to avoid that kind of situation. Once you've sent an email to a
> mailing list, and it is delivered, there is no recalling - that sucker
> will be archived in thousands of places for eternity - so try not to
> look like a fool!
>
> Cheers
>
> Tom

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



checkbox, how to return state back to html

2011-02-03 Thread gintare
views.py  "if statements" recognize that the box was checked.
I am not able to return the checkbox state back to web.html

I would like to see the last checkbox choices in my page.


web.html

 


views.py
def xxx(request):
cbSMWord  = request.POST.get('cbSMWord ','')
if (cbSMWord): print 'view recognized that checkbox was checked'
#this works

   print 'cbSMWord=', cbSMWord #this gives empty string, why?

   return render_to_response('c:/Python27/Scripts/Spokas/web.html',
{'cbSMWord':cbSMWord}, context_instance = RequestContext(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.



different length queries

2011-02-03 Thread gintare

answer to my previous question about different length queries
http://docs.djangoproject.com/en/dev/topics/db/sql/
#for p in Person.objects.raw('SELECT * FROM myapp_person')

Is it possible to post all the question which i send immediately?
Sometimes i find answer by myself.

I also soon would like to be able to delete all my posts and put
instead one summary post with main issues i met during self learning
from manuals.

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



different length queries

2011-02-03 Thread gintare
Hello,

Could you please advice if it is possible and where i could read OR at
least that keywords should search for the following question.

Is there a way to submit List =  [Q(word__starts='search_input'),
Q(date='search_input') ,]
to model.objects.filter (List).
How i have to formulate such list?

My query may contain from 1 to tens of restrictions
i.e. query with  1 item:
object. all.filter(Q(word__starts='search_input'))
versus query with 3 items:
object. all.filter( Q(word__starts='search_input')  ,
Q(date='search_input')  ,  Q( smth_else='search_input')   )

I know only programming basics and in order to execute selected
queries i have to write many if sentences.
i.e. query with  1 item:
if (word):  object. all.filter(Q(word__starts='search_input'))

versus query with 3 items:
if (word & date & smth_else ): object.
all.filter( Q(word__starts='search_input')  ,
Q(date='search_input')  ,  Q( smth_else='search_input')   )

Number of combination is very huge. Is there a way to submit a List
containing [Q(word__starts='search_input'),
Q(date='search_input') ,]
How i have to formulate such list?


P.s. In sqlite3 i can make a string in for cycle:

##for key in DSearch.keys():
##str2=str2+' ( '+str(key)+' LIKE '+item+')
AND'
## instead of LIKE i use one more if-elif cycle for search_method
starts, contains, ends, equal
##if (str2!=''):
##str3=str2[:-4]+' );'
##cursor.execute(st3);
##transaction.commit_unless_managed()
##ans=cursor.fetchall()

I would like to use Django.

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



django OneToOne field may not be NULL

2011-02-02 Thread gintare
Hello,

I would like to ask how i should correctly deal with OneToOne (OTO)
relation field .
When i create object from model with OTO fields i do not want to
assign any model to them. Maybe i will do in future when appropriate
object will appear.

Django do not let me to have not assigned OTO fields. At least i have
to create empty OTO object.

class Word(models.Model):
WwLksOTO=models.OneToOneField(Lks, related_name='WwmainLks',
blank=True, default='')## for input, goes to LinkModel and WordLinkMM
field

def save(self, *args, **kwargs):
if not self.id:
self.WwLksOTO=Lks.objects.create()
super(Word, self).save()

Now i just create LksOTO in save, since otherwise django generates the
error.

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



AttributeError 'module' object has no attribute '__path'

2011-02-01 Thread gintare
I searched all help,
could not find a solution.

Windows7
python and django runs from cmd

1) to run python
c:\Python27\python

2)to run django and to create the project

c:\Python27\python  c:\Python27\Scripts\django-admin.py   startproject
Spokas

THERE is an error while trying to create tables and runserver

c:\Python27\python  c:\amber\Spokas\manage.py runserver

AttributeError 'module' object has no attribute '__path'

I added *.pth files to different locations to check if it works:
c:\Python27\Libs\site-packages\Django
c:\Python27\Libs\site-packages
c:\amber
c:\amber\Spokas
None of directories nor none of their combination gave the result.

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



memory, time, 1000 lines model or 100 models with 10 lines

2011-02-01 Thread gintare
I have an object, which described in one model has 1000 lines.
Another way is to split object to 100 pieces with 10 lines length.

In both cases the 1000 lines will be filled in memory.

I am going to create tens of thousands entrances of this object.

If the object model will be split to 100 models, than the number of
entrances in database increase 100 times.

What is better performance of the Django, Sqlite3.
Have 20.000 entrances in the table with 1000 columns
or 2.000.000 entrances in the table with 10 columns

regards,
gintare

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



How to display empty custom or model based formset? form?

2011-01-30 Thread gintare
How to display empty custom or model based formset? form?

I am able to display only formset filled with data.

from django.forms.models import modelformset_factory
wFormSet=modelformset_factory(Word, max_num=4, extra=2,
fields=('Wordword', 'WordTranslEn')

#uncomment one of formsets. THIS EMPTY DO NOT WORK
#formsetw0=wFormSet()
#return render_to_response("c:/Python27/Scripts/Finnish2/Fin/
templates/trials/second.html", {
"formsetw": formsetw})

#THIS WORKS CORRECT
formsetw=wFormSet(queryset=Word.objects.filter(Q(Wordword__contains='joul')))
return render_to_response("c:/Python27/Scripts/Finnish2/Fin/
templates/trials/second.html", {
"formsetw": formsetw0})

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



example do not work, TypeError

2011-01-30 Thread gintare
simple question related to another example.
Django Version: 1.2.4
Exception Type: TypeError
Exception Value: 'WordFormFormSet' object is not iterable
Exception Location: c:\Python27\Scripts\Finnish2\..\Finnish2\Fin
\views.py in first, line 2492

# c:\Python27\lib\site-packages\django\core\handlers\base.py in
get_response
100. response = callback(request, *callback_args,
**callback_kwargs) ...

# c:\Python27\Scripts\Finnish2\..\Finnish2\Fin\views.py in first
2492. for form in formsetw:

 Example
http://docs.djangoproject.com/en/1.2/topics/forms/modelforms/

>>> AuthorFormSet = modelformset_factory(Author, max_num=4, extra=2)
>>> formset = AuthorFormSet(queryset=Author.objects.order_by('name'))



>>> for form in formset:
... print form.as_table()   # ERROR  'WordFormFormSet' object is
not iterable

= MY CODE

## views.py

def first(request):
from django.forms.models import modelformset_factory
w=modelformset_factory(Word, max_num=4, extra=2)
formsetw=wFormSet( queryset=Word.objects.filter( Q
(Wordword__contains='jouluku'))  )

   print 'formset=', formset  #prints long list of rows, why not
only 4

for form in formsetw:
print form.as_table()
form.save(commit=False)


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



simplest for example, Error object has no attribute 'cleaned_data'

2011-01-30 Thread gintare
Is it possible by making small change to resolve the error below:
(I did not yet finished reading all manual, maybe the error disappears
if i make custom code for every line in the model, but my model has
over 30 fields thus i would like to have automated save and post of
all these fields)

Django Version: 1.2.4
Exception Type: AttributeError
Exception Value:'WordFormM' object has no attribute 'cleaned_data'
Exception Location: c:\Python27\lib\site-packages\django\forms
\models.py in save_m2m, line 78

###views.py
from forms import FindWordM
from models import Word
from django.shortcuts import render_to_response,

def first(request):
w=Word.objects.get(pk=90);
formWord=WordFormM(instance=w);
formWord.save();
return render_to_response("c:/Python27/Scripts/Finnish2/Fin/
templates/trials/correct.html", {
"formWord": formWord})


###forms.py
from django.forms import ModelForm
from models import Word

class FindWordM(ModelForm):
class Meta:
model=Sent

###models.py
from django.db import models

class Word(models.Model):
WordSentences=models.TextField(max_length=1000,
blank=True,default='')
WordSentencesMM=models.ManyToManyField('self', null=True,
blank=True)
WordGramNotesDeclFK=models.ForeignKey(WordDeclN,
related_name='DeclNWord', null=True, blank=True)
...

###urls.py
from django.conf.urls.defaults import *

urlpatterns = patterns('',
(r'^first','Finnish2.Fin.views.first')
)

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



query did not work

2011-01-29 Thread gintare
would like to post one bug, since i was sitting 4h on it

For some reasons query did not work.
In the end appeared that it depends on how urls.py are formulated:

urlpatterns = patterns('',
   (r'^searchbooks','Finnish2.Fin.views.searchbooks'),   # page
http://127.0.0.1:8000/searchbooks is displayed, query works
   (r'^SB','Finnish2.Fin.views.searchbooks'), # page 
http://127.0.0.1:8000/SB
is displayed, query does not work, already print query statement in
views.searchbooks gives empty string
)

Maybe smbd can comment why this happens.


according oldmanual
http://www.djangobook.com/en/1.0/chapter07/


 Finnish2/Fin/
templates/trial/searchbooks.hmtl




< 


###  Finnish2/Fin/
forms.py

from django import forms
from models import  Item

class ContactBooksF(forms.Form):
serial_number = forms.CharField(widget=forms.Textarea())


###Finnish2/Fin/
models.py
from django.db import models

class Item(models.Model):
serial_number = models.CharField(max_length=15)

###   Finnish2/Fin/
views.py
from forms import ContactBooksF
from django.shortcuts import render_to_response,

def searchbooks(request):
query = request.GET.get('q', ''); print 'searchbooks query=',
query
if query:
print 'in query'
  #see http://www.djangobook.com/en/1.0/chapter07/
return render_to_response("c:/Python27/Scripts/Finnish2/Fin/
templates/trials/searchbooks.html", {"query": query })
})

def contactbooks(request):
form = ContactBooksF()
return render_to_response('c:/Python27/Scripts/Finnish2/Fin/
templates/trial/contactbooks.html', {'form': form})

###Finnish2/
urls.py

from django.conf.urls.defaults import *

urlpatterns = patterns('',
   (r'^searchbooks','Finnish2.Fin.views.searchbooks'),
)

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



additional infor to startind Django on Windows7

2011-01-24 Thread gintare
I would lile to add information to  unanswered thread
http://groups.google.com/group/django-users/browse_thread/thread/6bdc81a65804fde2/f94f116fe77c0c97?lnk=gst&q=gintare+start#f94f116fe77c0c97

In the end on windows7 Django worked from comman line (start, print
cmd):

cd c:\Python27\Scripts
c:\Python27\python django-admin.py --version

regards,
gintare

p.s
Django was installed in  c:\Python27\Lib\site-packages
by running from cmd
cd  c:\FolderWithUn7zipDjango
c:\Python27\python setup.py install



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



urgent, undo delete

2011-01-17 Thread gintare
Is it possible to undo  model.filter( field_gte = datemin ).delete()
if it was the action, which happened from function in views.py, by
accidentaly uncommenting the line

regards,
gintare statkute

-- 
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: list of lists in template

2011-01-16 Thread gintare
Thanks

On Jan 7, 9:27 am, Chris Matthews  wrote:
> {%  for Ltarp in  smth.3 %}
> SHOULD BE
> {%  for Ltarp in  smth.2 %}
> 'cos Lans only has 3 elements and Ltarp is Lans[2].
>
> Chris
>
> -Original Message-
> From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
> Behalf Ofgintare
> Sent: 07 January 2011 08:52
> To: Django users
> Subject: list of lists in template
>
> in view.py
> ...
> Ltarp.append([item.Wordword, item.WordTranslEn, item.WordNotesGram,
> item.WordConcl])
> ..
> Lans.append([sen.Sent, sen.SentTransl, Ltarp ] )
>
> in template.html
> {% if Lans %}
>
> {%  for smth in Lans %}
> 
>   {{smth.0}} 
>
>     {%  for Ltarp in  smth.3 %}
>     
>      {{Ltarp.0}} 
>
>     
>     {% endfor %}
>
> 
> {% endfor %}
>
> {% endif %}
>
> ###
>
> the rows from smth.0 are shown
> the rows from  Ltarp in  smth.3, i.e. {{Ltarp.0}} are not shown.
>
> I tried also:Ltarp, Ltarp[0], smth.Ltarp.0
>
> nothing works in the second for cycle where i need to get items from
> list built in third item of list in the first for cycle.
>
> Could you please help with syntax, when i need to dislay item from
> list in another list in template
>
> --
> 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 
> athttp://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.



to iterate over two lists simultaneously in *.html

2011-01-16 Thread gintare
Hello,

I am sorry for asking a simple question.
(I read other answer bout iteration in several items in this user
group - they are too complicated for me. I have no time to study
Django deeper. )
I want to iterate over two lists simultaneously in form which is
simple (.html), do not described in models.py or admin.py

## views.py
obj1=mod1.filter(field__contains='smth1').order('-date')
obj2=mod2.filter(field__contains='smth2').order('-date')

return render_to_response('filter_obj.html', {'List1':obj1, 'List2':
obj2, 'q': query })

## filter_obj.html

{% if List1 %}
{%  for smth1, smth2 in List1, List2 %}

 how to iterate here ?

-- 
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: ImproperlyConfigured: 'SentAdmin.fields' refers to field 'dateSent' that is missing from the form.

2011-01-08 Thread gintare
I did not understand what was the a reason, but i changed order of
items in admin.py fields to be similar to items order in the model.
Maybe mistake was some mistyping. Anyway error disappeared.

regards,
gintare

On Jan 2, 6:47 pm, Ramiro Morales  wrote:
> On Sun, Jan 2, 2011 at 12:49 PM,gintare wrote:
> > I was changing models many times and deleting tables inbetween.
> > New tables were generated to improved models and admin site worked
> > perfectly.
> > Now smth happened that i am getting error:
>
> > ImproperlyConfigured: 'SentAdmin.fields' refers to field 'dateSent'
> > that is missing from the form.
>
> > 'dateSent' is in the model and correctly described in admin.py
>
> > I did not added this field before generating new tables. It was
> > previously.
> > If i comment other fields gives the same error.
>
> > What can be the solution?
> > Should i make new project or there is a way to update forms (for
> > field 'dateSent' and orher fields that are missing from the form
> > according Django) ??
>
> Post only the definitions of the model containing dateSent and
> its ModelAdmin.
>
> Also:
>  Are you using dateSent somethwere else in the dmin.py?
>  Remove the admin.pyc file.
>
> --
> Ramiro Morales

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: form handling in views.py

2011-01-06 Thread gintare
Thanks a lot, i just wanted to know how to use variables from query
directly. If you could advice, please write me.

I read Django documentation on beginning of 2010 and understood only
now on 2011 where forms are used. I mean if smbd never programmed
webpages the use of templates and forms is totally unclear from
Documentation, afterwards it is very useful when one understands how
web-pages are generated from them (There could be some chapter for
beginners - full working example: model, view, templates, forms ).

On Jan 4, 10:19 pm, Daniel Roseman  wrote:
> On Tuesday, January 4, 2011 6:31:30 PM UTC, gintare wrote:
>
> > Maybe smbd could give advice how data submitted from custom.html to
> > views.py are handled further?
>
> >    custom.html  with method  search1 ##
>
> >  
> > {% if Lp %}
> > {%  for item in Lp %}
> > 
> > 
>
> > 
> >  
>
> >   > value="{{ query.0|escape}}"> {{item.Word}}   
>
> >  
> > {{item.dateWord}}   
>
> > 
> > 
> > 
> > {% endfor %}
> > {% endif %}
> > 
>
> >    views.py  with method  search1 ##
>
> > def search1(request):
> >     request.encoding='utf-8'
> >     query = request.GET.get( 'q','')
>
> > The code above works when i have one button and one text area.
>
> > I do not understand
> >  how to find out which input was selected and
> >  how to read text from many text areas (how to relate several text
> > areas in row with single button in that row ) .
>
> > regards,
> > gintare
>
> Don't do any of that. Instead, read the excellent documentation about the
> very nice forms framework:http://docs.djangoproject.com/en/1.2/topics/forms/
> --
> DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



list of lists in template

2011-01-06 Thread gintare

in view.py
...
Ltarp.append([item.Wordword, item.WordTranslEn, item.WordNotesGram,
item.WordConcl])
..
Lans.append([sen.Sent, sen.SentTransl, Ltarp ] )

in template.html
{% if Lans %}

{%  for smth in Lans %}

  {{smth.0}} 

{%  for Ltarp in  smth.3 %}

 {{Ltarp.0}} 


{% endfor %}


{% endfor %}

{% endif %}

###

the rows from smth.0 are shown
the rows from  Ltarp in  smth.3, i.e. {{Ltarp.0}} are not shown.

I tried also:Ltarp, Ltarp[0], smth.Ltarp.0

nothing works in the second for cycle where i need to get items from
list built in third item of list in the first for cycle.

Could you please help with syntax, when i need to dislay item from
list in another list in template

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



form handling in views.py

2011-01-04 Thread gintare
Maybe smbd could give advice how data submitted from custom.html to
views.py are handled further?


   custom.html  with method  search1 ##

 
{% if Lp %}
{%  for item in Lp %}




 

  {{item.Word}}   

 
{{item.dateWord}}   





{% endfor %}
{% endif %}



   views.py  with method  search1 ##


def search1(request):
request.encoding='utf-8'
query = request.GET.get( 'q','')

The code above works when i have one button and one text area.

I do not understand
 how to find out which input was selected and
 how to read text from many text areas (how to relate several text
areas in row with single button in that row ) .

regards,
gintare

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: to execute executable.py from view.py

2011-01-03 Thread gintare
One more related question.

Is it possible to use string in views.py as a function ( string from
textarea (in search.html ))

i.e.
# search.html

 input function name 



this search.html after being registered in urls.py shows input text
area.
I prompt to write the name of function.

I get this name as string in views.py in function def
search2(request):
query=request.GET.get('q',' ' )
i would like now to run this function, which was written in textarea,
 i.e to run function Word.objects.all()

One of ways is to use Sqlite cursor and execute strings.
Another way is to use case type structure, which match function name
in string with function name in cases.

How to run this function, which was written in textarea as string,
without sqlite and case structures?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



render_to_response

2011-01-03 Thread gintare

How formulate correctly the code below:

[code]
#views.py

def search(request):
..
answ = my_fnc(roots)
return render_to_response("my_fnc.html", { "answ" : answ } )

def  my_fnc( roots ):
FindWord=authors.objects.filter("name"__contains=roots)
return render_to_response("my_fnc.html", { " FindWord" :
FindWord } )

[code]

Gives error Manager isn't accessible via FindWord instances

I would like to get result of quesry in separate function.
How to return this result to initial function in view or print it to
*.html form from another function?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



ImproperlyConfigured: 'SentAdmin.fields' refers to field 'dateSent' that is missing from the form.

2011-01-02 Thread gintare
I was changing models many times and deleting tables inbetween.
New tables were generated to improved models and admin site worked
perfectly.
Now smth happened that i am getting error:

ImproperlyConfigured: 'SentAdmin.fields' refers to field 'dateSent'
that is missing from the form.

'dateSent' is in the model and correctly described in admin.py

I did not added this field before generating new tables. It was
previously.
If i comment other fields gives the same error.

What can be the solution?
Should i make new project or there is a way to update forms (for
field 'dateSent' and orher fields that are missing from the form
according Django) ??

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



constructor for model, automatically generate field, __init__

2011-01-01 Thread gintare

class Word:
fWord=models.CharField(blank=True, default='')
fsmth=models.CharField(blank=True, default='')
def __init__(self, fWord):
self.fWord=fWord
self.fsmth=fWord+fWord

I need to add entrance to fsmth automatically.
The code above gives mistakes in sites.py about Type error "classobj
is not iterable".

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



to execute executable.py from view.py

2010-12-29 Thread gintare
I would like by using

#in views.py


def myfnc():
subprocess.Popen( '/polls/executable.py', executable='/usr/lib/
python')



execute  executable.py from views.py function.

I am getting error that terminal is already taken. This is true -
django manage.py runserver keeps django webpages ON.

Is it possible to run paralelly python subprocess.Popen() ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: automatic addition of several ForeignKeys to model

2010-12-29 Thread gintare
Thanks.

The thing which i wanted must be done in forms. It is not for models
and database.

I mean there must be function in views.py which checks if some item
already exists in database and add information about this item
(item.pk) to another synonim item.

On 27 Gruo, 21:15, Emmanuel Mayssat  wrote:
> yes and no ;-)
> I am not sure I understand clearly, but I believe you want to have
> let's say 2 word1 links in word2
> For that you need yo use the related_name as otherwise in word1,
> django tries to create 2 word2 fields (which result in an error)
>
> 149 class Mentorship(models.Model):
> 154     mentee = models.ForeignKey(User, related_name='menteeship_set')
> 155     mentor = models.ForeignKey(User, related_name='mentorship_set')
>
>
>
> On Mon, Dec 27, 2010 at 10:00 AM,gintare wrote:
> > Hello,
>
> > I would like to add ForeignKey which would ass many items to class as
> > much i append-create-give.
>
> > class word1(models.Model):
> >    item=models.CharField(blank=True)
>
> > class word2(models.Model):
> >    itemSynonims=models.ForeignKey(word1)
>
> > i would like to add several word1 to the class word2.
>
> > Is there a way to create a pointer of type ForeignKey(word1), which
> > would
> > let to add many word1, word1, word1 to the same itemSynonims.
>
> > regards
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.- Slėpti cituojamą 
> > tekstą -
>
> - Rodyti cituojamą tekstą -

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



custom function for Admin, submit_line.html, views.py

2010-12-29 Thread gintare
1) Where is the *.py file and what is his name, in which there are
written functions related to 'Save and add another', 'Save and
continue editting' buttons of Admin site.
I do not understnad to which file i have to add custom functions for
admin.


2) How to add a button to Admin (i.e. submit_line.html), which
pressing would call function defined in views.py.

I would like to add "custom functions related to button in
submit_line.html"
 in such a way, that i would be able to call from them another custom
functions from views.py

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



add already existing items in database to field "synonims" as a hyperlinks

2010-12-27 Thread gintare
I mean to add already existing items in database to field "synonims"
as a hyperlinks.

> class word1(models.Model):
> item=models.CharField(blank=True)
>
> class word2(models.Model):
> itemSynonims=models. ??? HOW to define that this field will consist of 
> references to another words in the database?

On 27 Gruo, 20:00, gintare  wrote:
> Hello,
>
> I would like to add ForeignKey which would ass many items to class as
> much i append-create-give.
>
> class word1(models.Model):
>     item=models.CharField(blank=True)
>
> class word2(models.Model):
>     itemSynonims=models.ForeignKey(word1)
>
> i would like to add several word1 to the class word2.
>
> Is there a way to create a pointer of type ForeignKey(word1), which
> would
> let to add many word1, word1, word1 to the same itemSynonims.
>
> regards

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



automatic addition of several ForeignKeys to model

2010-12-27 Thread gintare
Hello,

I would like to add ForeignKey which would ass many items to class as
much i append-create-give.


class word1(models.Model):
item=models.CharField(blank=True)

class word2(models.Model):
itemSynonims=models.ForeignKey(word1)

i would like to add several word1 to the class word2.

Is there a way to create a pointer of type ForeignKey(word1), which
would
let to add many word1, word1, word1 to the same itemSynonims.

regards



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: windows7, django-admin.py, system variables, no module named django.core

2010-09-03 Thread gintare
Hello,

I mean the correct way of running django seems to be to add to windows
environmental variable PATH c:/first/Python26/Lib/site-packages/
Django-1.2.1/django/bin
and when run
$ cmd
$ django-admin.py startproject mysite

the question, why importing management from django.core do not work?
from django.core import management
Error: No module django.core

the module is under c:/first/Python26/Lib/site-packages/Django-1.2.1/
django
I mean it seems cmd must know where are all django modules. How?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: windows7, django-admin.py, system variables, no module named django.core

2010-09-03 Thread gintare
Thanks a lot!
Would like to clearify how i should run python from command line:

1)
cmd
#in command line shell under windows
cd c:/first/Pyhton26
#change to directory with pyhton executable
python   #
to start python environment in comman line shell
>>>>import sys
>>>>sys.path 
>>>>#prints  C:\first\Python26\Lib\site-packages as one of paths
>>>>django-admin.py syncdb   # ERROR -   name 
>>>>'django' is not defined


OR

2)
cmd
#in command line shell under windows
cd c:/first/Pyhton26
#change to directory with pyhton executable

pyhton django-admin.py syncdb#also ERROR: 'can
not open file django-admin.py'

pyhton django-admin syncdb#also ERROR: 'can
not open file django-admin'

django-admin.py syncdb#also ERROR: 'no module
named django.core'

django-admin syncdb#also ERROR: 'django-admin
is not recogmized as internal or external command'

The idea is that both "python executable"  and "django/bin/ with
django-admin.py" are in system path.
Should i put only pyhton on systme path?

3)
 I have several different pyhton installations. How cmd can recognize
python command if they all are under system path?
Does it first look in current working directory: I.e. if i start from
c:/fisrt/python26 it will not run python from c:/second/python31?






On Aug 25, 12:49 pm, Sam Lai  wrote:
> If you want to understand why you are getting the error, start by
> understanding Python modules -http://docs.python.org/tutorial/modules.html
>
> Hint - you can't just copy a script around and expect it to work. The
> script depends on other files to make it all happen.
>
> If in python, you type,
>
> import sys
> sys.path
>
> ... and you see something like C:\first\Python26\Lib\site-packages, it
> should work fine assuming Django was installed using setuptools or
> pip. If not, you should look into using that instead of manually
> installing it.
>
> If you insist on doing it manually, you need to look into creating a
> .pth file to add the packages into the PYTHONPATH.
>
> On 25 August 2010 18:06,gintare wrote:
>
>
>
> > I am not able to run django under windows7
>
> > python django-admin.py  #is recognized if i paste it to c:/first/
> > Python26 together with python executable.
>
> > I am getting error:  No module named django.core
> > File "django-admin.py", line2, in 
> > from django.core import management
>
> > It seems the command line do not know about variables in the path:
> > Python django-admin.py    #is not recognized if i use path variable
> >  "C:/first/Python26/Lib/site-packages/django-1.2.1/django/bin"
> > It is recongmized as a command in if paste it to C:/first/Python26.
>
> > I added paths to System Path Variable:
> > C:/first/Python26
> > which contains copy af django-admin.py
> > C:/first/Python26/Scripts                                      which
> > contains copy af django-admin.py
> > C:/first/Python26/Lib/site-packages/django-1.2.1/django/bin      -
> > original django-admin.py
>
> > I run from command line cmd beeingin c:/first/Python26
> > python  # command works
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



windows7, django-admin.py, system variables, no module named django.core

2010-08-25 Thread gintare
I am not able to run django under windows7

python django-admin.py  #is recognized if i paste it to c:/first/
Python26 together with python executable.

I am getting error:  No module named django.core
File "django-admin.py", line2, in 
from django.core import management

It seems the command line do not know about variables in the path:
Python django-admin.py#is not recognized if i use path variable
 "C:/first/Python26/Lib/site-packages/django-1.2.1/django/bin"
It is recongmized as a command in if paste it to C:/first/Python26.

I added paths to System Path Variable:
C:/first/Python26
which contains copy af django-admin.py
C:/first/Python26/Scripts  which
contains copy af django-admin.py
C:/first/Python26/Lib/site-packages/django-1.2.1/django/bin  -
original django-admin.py

I run from command line cmd beeingin c:/first/Python26
python  # command works

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: character , HTML textfield, sqlite3

2010-03-12 Thread gintare
If somebody knows how to answer my questions please let me know. It is
very urgent.
I will modify code by advice of Daniel as fast as i have time =
"never" :)

On Mar 11, 3:43 pm, Daniel Roseman  wrote:
> On Mar 11, 1:19 pm,gintare wrote:
>
>
>
> > Hello,
>
> > How to save special characters: å , ö, ä...
>
> > I tried to write them in browsers input field in several ways:
> > å , ö, ä...
> > \xc3\xa5 ,   \xc3\xa4,  \xc3\xb6
>
> > I am using sqlite syntax for saving
> > from HTML tetxtarea
> > to the sqlite3 database textfield:
> >  models.CharField(max_length=500, blank=True, default='').
>
> >     for i in range(len(Ltitles)): stLtit=stLtit
> > +smart_unicode(Ltitles[i], encoding='utf-8', strings_only=False,
> > errors='strict')+' , '
> >     st2='INSERT into Ath_aref'+ ' ('+stLtit+') VALUES '+'('+stLq
> > +');' ; print 'my_custom_sql st2=', st2
> >     cursor.execute(st2); st2=''
> >     transaction.commit_unless_managed()
>
> > regards
> >gintarestatkute
>
> 1. Why are you using custom SQL when Django takes care of this for
> you?
> 2. Why are you using bytestrings rather than Unicode strings?
> 3. Why are you inserting POSTed data directly into database commands,
> rather than using parameterized queries, leaving yourself open to SQL
> injection?
> --
> DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



character , HTML textfield, sqlite3

2010-03-11 Thread gintare
Hello,

How to save special characters: å , ö, ä...

I tried to write them in browsers input field in several ways:
å , ö, ä...
\xc3\xa5 ,   \xc3\xa4,  \xc3\xb6



I am using sqlite syntax for saving
from HTML tetxtarea
to the sqlite3 database textfield:
 models.CharField(max_length=500, blank=True, default='').

for i in range(len(Ltitles)): stLtit=stLtit
+smart_unicode(Ltitles[i], encoding='utf-8', strings_only=False,
errors='strict')+' , '
st2='INSERT into Ath_aref'+ ' ('+stLtit+') VALUES '+'('+stLq
+');' ; print 'my_custom_sql st2=', st2
cursor.execute(st2); st2=''
transaction.commit_unless_managed()

regards
gintare statkute

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



gintare

2010-03-07 Thread gintare
Hello,

Is it possible in python access name of variable?
I want to convert the name of the variable to the string, not the
value of variable to the string.

For example for item inclass  Aref: List.append( str(name_of _item) )
i want 'Rfirstauthor' to be inserted in List[0], not the value of
variable Rfirstauthor = 'John Smith'

models.py

class Aref(models.Model):
Rfirstauthor=models.CharField(max_length=500, blank=True,
default='')
.

thanks,
gintare

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: Sqlite3, saving many items simultaneosly

2010-03-07 Thread gintare
Thanks for both of you!

On Mar 5, 6:37 pm, Atamert Ölçgen  wrote:
> On Friday 05 March 2010 18:09:22gintarewrote:> b = Blog(  [name, tagline] , 
> ['Beatles Blog', 'All the latest Beatles
> > news]  )
>
> > >>> b.save()
>
> How many items are you saving at once? Have you measured the time required to
> execute these queries and the total time your view/management command takes?
> Do you really need to optimize here and now to do custom SQL?
>
> > I do not want to call save(column_name, item_value) for every item
> > separately, i.e.:
> > b = Blog(name='Beatles Blog', tagline='All the latest Beatles news.')
>
> > >>> b.save()
>
> You can use create() manager method to achieve this in one step.
>
> --
> Saygılarımla,
> Atamert Ölçgen
>
>  -+-
>  --+
>  +++
>
> www.muhuk.com
> mu...@jabber.org

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



Sqlite3, saving many items simultaneosly

2010-03-05 Thread gintare
Hello,

Is it possible to pack name of the column and value before submitting
to the database.
I mean something to save( dictionary), where dictionaries key is the
name of column and dictionaries item is value to be saved) or
save(list_column_names, list_values)?

b = Blog(  [name, tagline] , ['Beatles Blog', 'All the latest Beatles
news]  )
>>> b.save()


I do not want to call save(column_name, item_value) for every item
separately, i.e.:
b = Blog(name='Beatles Blog', tagline='All the latest Beatles news.')
>>> b.save()

My database consist of 20 columns.
Now i am using Sqlite3 syntax, where i print all column and item
names  to one string.

regards,
gintare

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: formatting results of search

2010-03-04 Thread gintare
Thanks,

How about values in database?
Than i am retrieving data from database i am getting:
(3, u' ANN I. PERSSON1', u' MAGNUS W. LARSSON2, STIG STENSTR\xd6M3, B.
JONAS OHLSSON1, LARS SAMUELSON1 AND L. REINE WALLENBERG2 ', u' nature
materials', u' ..

Is it possible to write to databse normal string without preceding
u'  ?
I am using smart_unicode() function to be able to save special
characters in database.

#Ath.html





#view.py
def search1(request):
Lq,stitles, query = [ ] , string_column _names,
request.GET.get( 'q','')
Lq=query.split('<')
   my_custom_sql( Lq, Ltitles)

def my_custom_sql( Lq, stitles):
from django.db import connection, transaction
cursor = connection.cursor()
for i in range(len(Lq)): stLq=stLq+'\"'+smart_unicode(Lq[i],
encoding='utf-8', strings_only=False, errors='strict')+'\"'+' , '
st2='insert into Ath_aref'+ ' ( ' + stitles + ' ) values ' + '(' +
stLq+ '); '
cursor.execute(st2);
transaction.commit_unless_managed()


regards,
gintare





On Feb 22, 1:15 am, Dennis Kaarsemaker  wrote:
> On wo, 2010-02-17 at 05:32 -0800,gintarewrote:
>
> > @@in *.html
> > @@using line  {{ word|escape }}
>
> > @@i am getting printed answer :(u'moi',)  instead of moi.
> > @@I need only word moi (without any brakets, quatations) be visible in
> > a webpage.
>
> In this case you want word.0|escape
>
> values() always returns a sequence of tuples.
> --
> Dennis K.
>
> The universe tends towards maximum irony. Don't push it.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: what has to be changed after project.db deletion and new empty project.db file creation manually

2010-03-04 Thread gintare
Thanks
now it works,

In time i posted the question syncdb did not generated database file
"referenc.db".
Thats i posted the question.
Now it works normally again.

regards,
gintare

On Mar 3, 6:02 pm, Matt McCants  wrote:
> For sqlite3, you don't even need to create an empty db. Just put the desired
> filename in your settings.py for the database name and run
>
> python manage.py syncdb
>
> and the database will be created along with all the tables based on the
> models for all the installed apps. You don't actually need to run the sql
> command unless you're just interested in what Django is going to do when you
> run syncdb. Or you're going to manually run the SQL or modify it to alter
> existing structure.
>
> I'm not sure if I'm misunderstanding, but it sounds like you made the
> changes in the database without making the changes to your models. It's all
> about the models! Make the changes there then re-run syncdb. Hope this helps
> some. There really aren't any lines to change, just a process to follow.
>
> On Wed, Mar 3, 2010 at 1:47 AM, gintare  wrote:
> > Hello.
>
> > to summarize the question is
>
> > which lines has to be changed when the database file i.e, referenc.db
> > is deleted and later created manually as empty database?
>
> > The problem is that i created whole project a week before.
> >  Later i modified modules, added new tables and new fields (Rrest
> > column was added for sure in table Areferenc_aref).
> >  I deleted empty database file referenc.db, created new database file
> > referenc.db manually expecting that new tables will be generated with
> > additional fields for hem.
>
> > Nevertheless the django finds only old columns.
>
> > besides i made one check:
>
> > 1) first of all i totally deleted referenc.db again. For big surprise
> > command manage.py syncdb runs without mistakes.
>
> > Besides python manage.py sql Areferenc  generates tables for non
> > existing database.
>
> > ^Cworking:/opt/pages/referenc# python manage.py sql Areferenc
>
> > BEGIN;
> > CREATE TABLE "Areferenc_aref" (
> >    "id" integer NOT NULL PRIMARY KEY,
> >    "Rfirstauthor" varchar(500) NOT NULL,
> >     "Rauthors" varchar(500) NOT NULL,
> >    "Rjournal" varchar(500) NOT NULL,
> >    "Rrest" varchar(500) NOT NULL,
> >    "Rpage" varchar(500) NOT NULL,
> >    "Rissue" integer NOT NULL,
> >     "Rvolume" integer NOT NULL,
> >    "Ryear" integer NOT NULL,
> >    "Rtitle" varchar(500) NOT NULL,
> >    "Rkeyw" varchar(500) NOT NULL,
> >    "Rurl" varchar(200) NOT NULL,
> >     "Rindex" varchar(500) NOT NULL,
> >    "Rname" varchar(500) NOT NULL,
> >    "Rdoi" varchar(500) NOT NULL,
> >    "Rlink" varchar(100) NOT NULL,
> >    "Rmail" varchar(75) NOT NULL,
> >     "Rconcl" text NOT NULL,
> >    "Rexists" bool NOT NULL,
> >    "Rinst" varchar(500) NOT NULL
> > )
> > ;
> > CREATE TABLE "Areferenc_experimental" (
> >    "id" integer NOT NULL PRIMARY KEY,
> >     "Rexp" varchar(500) NOT NULL
> > )
> > ;
> > CREATE TABLE "Areferenc_characterization" (
> >    "id" integer NOT NULL PRIMARY KEY,
> >    "Rchar" varchar(500) NOT NULL
> > )
> > ;
> >  CREATE TABLE "Areferenc_devices" (
> >    "id" integer NOT NULL PRIMARY KEY,
> >    "Rdev" varchar(500) NOT NULL
> > )
> > ;
> > CREATE TABLE "Areferenc_calculations" (
> >    "id" integer NOT NULL PRIMARY KEY,
> >     "Rcal" varchar(500) NOT NULL
> > )
> > ;
> > CREATE TABLE "Areferenc_afieldorder" (
> >    "id" integer NOT NULL PRIMARY KEY,
> >    "Rorder" varchar(500) NOT NULL
> > )
> > ;
> > CREATE TABLE "Areferenc_aref_Rexperimental" (
> >     "id" integer NOT NULL PRIMARY KEY,
> >    "aref_id" integer NOT NULL REFERENCES "Areferenc_aref" ("id"),
> >    "experimental_id" integer NOT NULL REFERENCES
> > "Areferenc_experimental" ("id"),
> >     UNIQUE ("aref_id", "experimental_id")
> > )
> > ;
> > CREATE TABLE "Areferenc_aref_Rcharacterization" (
> >    "id" integer NOT NULL PRIMARY KEY,
> >    "aref_id

what has to be changed after project.db deletion and new empty project.db file creation manually

2010-03-02 Thread gintare
Hello.

to summarize the question is

which lines has to be changed when the database file i.e, referenc.db
is deleted and later created manually as empty database?

The problem is that i created whole project a week before.
 Later i modified modules, added new tables and new fields (Rrest
column was added for sure in table Areferenc_aref).
 I deleted empty database file referenc.db, created new database file
referenc.db manually expecting that new tables will be generated with
additional fields for hem.

Nevertheless the django finds only old columns.

besides i made one check:

1) first of all i totally deleted referenc.db again. For big surprise
command manage.py syncdb runs without mistakes.

Besides python manage.py sql Areferenc  generates tables for non
existing database.

^Cworking:/opt/pages/referenc# python manage.py sql Areferenc

BEGIN;
CREATE TABLE "Areferenc_aref" (
"id" integer NOT NULL PRIMARY KEY,
"Rfirstauthor" varchar(500) NOT NULL,
 "Rauthors" varchar(500) NOT NULL,
"Rjournal" varchar(500) NOT NULL,
"Rrest" varchar(500) NOT NULL,
"Rpage" varchar(500) NOT NULL,
"Rissue" integer NOT NULL,
 "Rvolume" integer NOT NULL,
"Ryear" integer NOT NULL,
"Rtitle" varchar(500) NOT NULL,
"Rkeyw" varchar(500) NOT NULL,
"Rurl" varchar(200) NOT NULL,
 "Rindex" varchar(500) NOT NULL,
"Rname" varchar(500) NOT NULL,
"Rdoi" varchar(500) NOT NULL,
"Rlink" varchar(100) NOT NULL,
"Rmail" varchar(75) NOT NULL,
 "Rconcl" text NOT NULL,
"Rexists" bool NOT NULL,
"Rinst" varchar(500) NOT NULL
)
;
CREATE TABLE "Areferenc_experimental" (
"id" integer NOT NULL PRIMARY KEY,
 "Rexp" varchar(500) NOT NULL
)
;
CREATE TABLE "Areferenc_characterization" (
"id" integer NOT NULL PRIMARY KEY,
"Rchar" varchar(500) NOT NULL
)
;
 CREATE TABLE "Areferenc_devices" (
"id" integer NOT NULL PRIMARY KEY,
"Rdev" varchar(500) NOT NULL
)
;
CREATE TABLE "Areferenc_calculations" (
"id" integer NOT NULL PRIMARY KEY,
 "Rcal" varchar(500) NOT NULL
)
;
CREATE TABLE "Areferenc_afieldorder" (
"id" integer NOT NULL PRIMARY KEY,
"Rorder" varchar(500) NOT NULL
)
;
CREATE TABLE "Areferenc_aref_Rexperimental" (
 "id" integer NOT NULL PRIMARY KEY,
"aref_id" integer NOT NULL REFERENCES "Areferenc_aref" ("id"),
"experimental_id" integer NOT NULL REFERENCES
"Areferenc_experimental" ("id"),
 UNIQUE ("aref_id", "experimental_id")
)
;
CREATE TABLE "Areferenc_aref_Rcharacterization" (
"id" integer NOT NULL PRIMARY KEY,
"aref_id" integer NOT NULL REFERENCES "Areferenc_aref" ("id"),
 "characterization_id" integer NOT NULL REFERENCES
"Areferenc_characterization" ("id"),
UNIQUE ("aref_id", "characterization_id")
)
;
CREATE TABLE "Areferenc_aref_Rdevice" (
 "id" integer NOT NULL PRIMARY KEY,
"aref_id" integer NOT NULL REFERENCES "Areferenc_aref" ("id"),
"devices_id" integer NOT NULL REFERENCES
"Areferenc_devices" ("id"),
 UNIQUE ("aref_id", "devices_id")
)
;
CREATE TABLE "Areferenc_aref_Rcalculation" (
"id" integer NOT NULL PRIMARY KEY,
"aref_id" integer NOT NULL REFERENCES "Areferenc_aref" ("id"),
 "calculations_id" integer NOT NULL REFERENCES
"Areferenc_calculations" ("id"),
UNIQUE ("aref_id", "calculations_id")
)
;
COMMIT

2) Secondly I created referenc.db in  ./referenc manually again.

generated tables with command mentioned in step1 with the same output
(table Areferenc_aref contains column Rrest )

performed manage.py syncdb, which went fluently without mistakes.

executing view i am getting error:

Exception Type:
OperationalError
  Exception Value:
table Areferenc_aref has no column named Rrest
  Exception Location:
/usr/lib/python2.5/site-packages/django/db/backends/sqlite3/base.py in
execute, line 193

  :


:


  regards,
gintare

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



insert satement do not work, django can not find the column

2010-03-02 Thread gintare statkute
Hello.

to summarize the question is

which lines has to be changed when the database file i.e, referenc.db is
deleted and later created manually as empty database?

The problem is that i created whole project a week before.
Later i modified modules, added new tables and new fields (Rrest column was
added for sure in table Areferenc_aref).
I deleted empty database file referenc.db, created new database file
referenc.db manually expecting that new tables will be generated with
additional fields for hem.

Nevertheless the django finds only old columns.

besides i made one check:

1) first of all i totally deleted referenc.db again. For big surprise
command manage.py syncdb runs without mistakes.

Besides python manage.py sql Areferenc  generates tables for non existing
database.

^Cworking:/opt/pages/referenc# python manage.py sql Areferenc

BEGIN;
CREATE TABLE "Areferenc_aref" (
"id" integer NOT NULL PRIMARY KEY,
"Rfirstauthor" varchar(500) NOT NULL,
"Rauthors" varchar(500) NOT NULL,
"Rjournal" varchar(500) NOT NULL,
"Rrest" varchar(500) NOT NULL,
"Rpage" varchar(500) NOT NULL,
"Rissue" integer NOT NULL,
"Rvolume" integer NOT NULL,
"Ryear" integer NOT NULL,
"Rtitle" varchar(500) NOT NULL,
"Rkeyw" varchar(500) NOT NULL,
"Rurl" varchar(200) NOT NULL,
"Rindex" varchar(500) NOT NULL,
"Rname" varchar(500) NOT NULL,
"Rdoi" varchar(500) NOT NULL,
"Rlink" varchar(100) NOT NULL,
"Rmail" varchar(75) NOT NULL,
"Rconcl" text NOT NULL,
"Rexists" bool NOT NULL,
"Rinst" varchar(500) NOT NULL
)
;
CREATE TABLE "Areferenc_experimental" (
"id" integer NOT NULL PRIMARY KEY,
"Rexp" varchar(500) NOT NULL
)
;
CREATE TABLE "Areferenc_characterization" (
"id" integer NOT NULL PRIMARY KEY,
"Rchar" varchar(500) NOT NULL
)
;
CREATE TABLE "Areferenc_devices" (
"id" integer NOT NULL PRIMARY KEY,
"Rdev" varchar(500) NOT NULL
)
;
CREATE TABLE "Areferenc_calculations" (
"id" integer NOT NULL PRIMARY KEY,
"Rcal" varchar(500) NOT NULL
)
;
CREATE TABLE "Areferenc_afieldorder" (
"id" integer NOT NULL PRIMARY KEY,
"Rorder" varchar(500) NOT NULL
)
;
CREATE TABLE "Areferenc_aref_Rexperimental" (
"id" integer NOT NULL PRIMARY KEY,
"aref_id" integer NOT NULL REFERENCES "Areferenc_aref" ("id"),
"experimental_id" integer NOT NULL REFERENCES "Areferenc_experimental"
("id"),
UNIQUE ("aref_id", "experimental_id")
)
;
CREATE TABLE "Areferenc_aref_Rcharacterization" (
"id" integer NOT NULL PRIMARY KEY,
"aref_id" integer NOT NULL REFERENCES "Areferenc_aref" ("id"),
"characterization_id" integer NOT NULL REFERENCES
"Areferenc_characterization" ("id"),
UNIQUE ("aref_id", "characterization_id")
)
;
CREATE TABLE "Areferenc_aref_Rdevice" (
"id" integer NOT NULL PRIMARY KEY,
"aref_id" integer NOT NULL REFERENCES "Areferenc_aref" ("id"),
"devices_id" integer NOT NULL REFERENCES "Areferenc_devices" ("id"),
UNIQUE ("aref_id", "devices_id")
)
;
CREATE TABLE "Areferenc_aref_Rcalculation" (
"id" integer NOT NULL PRIMARY KEY,
"aref_id" integer NOT NULL REFERENCES "Areferenc_aref" ("id"),
"calculations_id" integer NOT NULL REFERENCES "Areferenc_calculations"
("id"),
UNIQUE ("aref_id", "calculations_id")
)
;
COMMIT

2) Secondly I created referenc.db in  ./referenc manually again.

generated tables with command mentioned in step1 with the same output (table
Areferenc_aref contains column Rrest )

performed manage.py syncdb, which went fluently without mistakes.

executing view i am getting error:
Exception Type: OperationalError  Exception Value:

table Areferenc_aref has no column named Rrest

 Exception Location:
/usr/lib/python2.5/site-packages/django/db/backends/sqlite3/base.py
in execute, line 193
:

  :

regards,
gintare

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



mouse events and view.py

2010-02-20 Thread gintare
How correctly define syntax for the event in templates?

I want that all text in the text area
would be send to the python function "search2"
after i paste text or click mouse.
After making changes the text has to be pasted back to the same form.

Is it possible with python or i need java script?

Bellow is view.py and diction.html which do not work,
 i.e. line:   " print "search2", search2, query "
do not print in terminal words which i pasted to the text area.

##diction.html


  
 

##views.py
def search2(request):
query = request.GET.get('Lpasted', '')
print "search2", search2, query
t=get_template(Tdiction.html)
html=t.render( Context({'Lpasted':sentenc}) )
return HttpResponse(html)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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: simple, input from user and database earch result

2010-02-20 Thread gintare
What do you mean by :
> > The have the view that the form posts back to put the result of the search 
> > in the generated HTML for the result.
What is the name of view, in which folder.

My question was:
> >  1>  2   
>
> > On line 1 user put a word
> > On line 2 user start search in database
> > I would like to get the result of the search printed back in the same
> > field on the line 1.
>From the examples of Django the search result is printed below on the
webpage, but not in the same field where search was performed.
if you could paste code of any example it would be grate.

gintare


On 17 Vas, 18:10, Malcolm Box  wrote:
> On Wed, Feb 17, 2010 at 3:12 PM, gintare  wrote:
>
> > One more simple question:
>
> > Is it possible that area which is used for data submission also can be
> > updated from python script.
>
> It's not clear what you mean by this.  The python (Django) script isn't
> running in the webbrowser, so it can't update the webbrowser unless the
> browser makes a HTTP request and then renders the response.
>
> >  1    >  2   
>
> > On line 1 user put a word
> > On line 2 user start search in database
> > I would like to get the result of the search printed back in the same
> > field on the line 1.
>
> > The have the view that the form posts back to put the result of the search
>
> in the generated HTML for the result.
>
> Malcolm

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



simple, input from user and database earch result

2010-02-17 Thread gintare
Hello,

One more simple question:

Is it possible that area which is used for data submission also can be
updated from python script.

How in *.html describe that input can be both
from the user
and a result of some script.


 1   

On line 1 user put a word
On line 2 user start search in database
I would like to get the result of the search printed back in the same
field on the line 1.

regards,
gintare

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



formatting results of search

2010-02-17 Thread gintare
@@in views.py i am making search in database:

def search1(request):
#..
 results = EntryD.objects.filter(qset).values_list('fwordE')
#
 return render_to_response("diction.html", {
"results": results,
"query": query
})


@@in *.html
@@using line  {{ word|escape }}

@@i am getting printed answer :(u'moi',)  instead of moi.
@@I need only word moi (without any brakets, quatations) be visible in
a webpage.

How correctly format results of search in database when they are
posted to *.html?

regards,
gintare

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.



django_evolution evolve not found

2010-02-05 Thread gintare
I have installed django_evolution from Debian package.
It is now under /usr/lib/pyhton2.5/site-packages/django_evolution

i also added :
 ln -s `pwd` /django-trunk/django   /usr/lib/python2.5/site-packages/
django_evolution

But the command 'evolve' is not recognized.
I.e. i am in project "links" directory and try to run evolution in
several ways, i.e.:
python manage.py evolve --hint
evolve.py --hint
evolve

none of do work.

Is it possible to get working version of package similar to evolution.
Or maybe it is possible somehow correct this installation or give
additional command line parameters.

regards,
gintare

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 relate webpage with databse in my harddisk?

2010-01-07 Thread gintare
One more question:

Is it possible to add "mysite" to some external server and be able to
access it as a superuser for me or as normal users for others?

How and where i could put "mysite"?


On Jan 6, 11:31 pm, Kenny Meyer  wrote:
> > How other can access pages i generated with django?
>
> You mean how others can access pages which Django generated *for you*.
> If you're connected with computers in a home network they can see your
> work with a webbrowser, knowing the IP address of the Pc which is
> serving the Django "pages". Usually this is :8000 if
> you're using Django's development server.
> If you want to deploy it on a web server, read 
> this:http://docs.djangoproject.com/en/dev/howto/deployment/> How others could 
> be able to fill forms and get data from my hard disk
> > through generated html interface?
>
> Through a webbrowser.> I would like to connect to generated html pages 
> through internet [..]
>
> Redirect traffic from your router which is incoming on port 80 to your
> local machine to any port on which your webserver is running. Now that's
> a very brief how-to. Google is your friend.
>
>  signature.asc
> < 1KViewDownload
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.




how relate webpage with databse in my harddisk?

2010-01-06 Thread gintare
Hello,

Sorry for a simple question.

How other can access pages i generated with django?
How others could be able to fill forms and get data from my hard disk
through generated html interface?

I am connecting and filling database by myself in folder  /mano/
mysite1.
I would like to connect to generated html pages through internet from
remote computer, fill questionaries and leave or get data to/from
database.

regards,
gintare
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.




error in the example

2009-12-30 Thread gintare
   Hello,

 In short
 OS Debian Gnu Linux Lenny
 Python 2.5
 Installed Django-1.1.1.tar.gz,
/usr/lib/python-django/Django-1.1.1/docs/intro/tutorial01.txt

command python manage.py sql polls
gives error:   IndentationError: unexpected indent
in   File "/mano/mysite3/../mysite3/polls/models.py",
  line 5
 class Poll (models.Model):

What is wrong with syntax in this line "class Poll (models.Model):" ?

---
trying according example:
/usr/lib/python-django/Django-1.1.1/docs/intro/tutorial01.txt

the sequence of the commands, which went fluently was:

`django-admin.py startproject mysite3'
(i have to make adjustments to settings.py choosing Sqlite3 and
creating database)

python manage.py runserver
python manage.py syncdb
python manage.py startapp polls

creates folder polls with file models.py into which i have to paste
code from tutorial01.txt
.
class Poll(models.Model):
question = models.CharField(max_length=200)
.

the next command python manage.py sql polls
gives error: IndentationError: unexpected indent
in   File "/mano/mysite3/../mysite3/polls/models.py",
  line 5
 class Poll (models.Model):

--
The whole error report:

working:/mano/mysite3# python manage.py sql polls
Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File "/usr/lib/python2.5/site-packages/django/core/management/
__init__.py", line 362, in execute_manager
utility.execute()
  File "/usr/lib/python2.5/site-packages/django/core/management/
__init__.py", line 303, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.5/site-packages/django/core/management/
base.py", line 195, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.5/site-packages/django/core/management/
base.py", line 221, in execute
self.validate()
  File "/usr/lib/python2.5/site-packages/django/core/management/
base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
  File "/usr/lib/python2.5/site-packages/django/core/management/
validation.py", line 28, in get_validation_errors
for (app_name, error) in get_app_errors().items():
  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
line 131, in get_app_errors
self._populate()
  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
line 58, in _populate
self.load_app(app_name, True)
  File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
line 74, in load_app
models = import_module('.models', app_name)
  File "/usr/lib/python2.5/site-packages/django/utils/importlib.py",
line 35, in import_module
__import__(name)
  File "/mano/mysite3/../mysite3/polls/models.py", line 5
class Poll(models.Model):
^
IndentationError: unexpected indent

regards,
gintare
g.statk...@gmail.com

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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 haven't set the DATABASE_ENGINE setting

2009-12-30 Thread gintare statkute
Thanks,

reinstalled :)

gintare

On 12/30/09, Ramiro Morales  wrote:
> On Wed, Dec 30, 2009 at 4:22 PM, gintare  wrote:
>> Hello,
>>
>> OS Debian Gnu Linux Lenny
>> Python 2.5
>> Installed python-django_1.0.2-1+lenny2_all.deb with K-package  instead
>> of  Django-1.1.1.tar.gz,
>>
>> it was configured according instalation site:
>> http://docs.djangoproject.com/en/dev/topics/install/#installing-official-release
>
> You are using Django 1.0.x launched almost 15 months ago
> and following the the documentation that describes the
> development version of Django as of now.
>
> Lookup and follow the correct document set.
>
> Regards,
>
> --
> Ramiro Morales  |  http://rmorales.net
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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.




error haven't set the DATABASE_ENGINE setting

2009-12-30 Thread gintare
Hello,

OS Debian Gnu Linux Lenny
Python 2.5
Installed python-django_1.0.2-1+lenny2_all.deb with K-package  instead
of  Django-1.1.1.tar.gz,

it was configured according instalation site:
http://docs.djangoproject.com/en/dev/topics/install/#installing-official-release
working:/mano/mysite1# ln -s 'pwd'/django-trunk/django/bin/django-
admin.py /usr/local/bin



trying to run example
in folderDjango-1.1.1/examples after untaring file:///opt/sql
anywhere files/sqlany-django.1.1.tar.gz
acording to   http://docs.djangoproject.com/en/dev/intro/tutorial01/
commandpython manage.py syncdb
gives an error  File "/var/lib/python-support/python2.5/django/db/
backends/dummy/base.py", line 15, in complain
raise ImproperlyConfigured, "You haven't set the DATABASE_ENGINE
setting yet."

How to set DATABASE_ENGINE?


settings.py
-
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ROOT_URLCONF = 'examples.urls'

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/mano/mysite1/band1.db'
}
}
-

command
working:/mano/mysite1# python manage.py syncdb

error
Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File "/var/lib/python-support/python2.5/django/core/management/
__init__.py", line 340, in execute_manager
utility.execute()
  File "/var/lib/python-support/python2.5/django/core/management/
__init__.py", line 295, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/var/lib/python-support/python2.5/django/core/management/
base.py", line 192, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/var/lib/python-support/python2.5/django/core/management/
base.py", line 219, in execute
output = self.handle(*args, **options)
  File "/var/lib/python-support/python2.5/django/core/management/
base.py", line 348, in handle
return self.handle_noargs(**options)
  File "/var/lib/python-support/python2.5/django/core/management/
commands/syncdb.py", line 51, in handle_noargs
cursor = connection.cursor()
  File "/var/lib/python-support/python2.5/django/db/backends/dummy/
base.py", line 15, in complain
raise ImproperlyConfigured, "You haven't set the DATABASE_ENGINE
setting yet."
django.core.exceptions.ImproperlyConfigured: You haven't set the
DATABASE_ENGINE setting yet.
working:/mano/mysite1#

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.