Re: Mysterious error messages

2013-09-22 Thread kooliah
I'm sorry but i started to send this message at 12.09 ...and at 14.00 
google groups still does not show me neither on mail or web-interface. 
so i resend...


Sorry again, next time i'll wait 24 hours, to see if a post is sent...




On 09/22/2013 04:27 PM, Avraham Serour wrote:

really? how many times do you need to send and resend and cross post?


On Sun, Sep 22, 2013 at 1:23 PM, > wrote:


Everyday i receive 5-10 mysterious error messages of this kind

... ERRORS.

  File
"../satchmo/satchmo/apps/satchmo_store/shop/context_processors.py",
line 31, in settings
'shop_name': shop_config.store_name,

AttributeError: 'NoneType' object has no attribute 'store_name'


,
POST:,



  File
".../satchmo/satchmo/apps/satchmo_store/shop/context_processors.py",
line 31, in settings
'shop_name': shop_config.store_name,

AttributeError: 'NoneType' object has no attribute 'store_name'


,



  File "/django/db/backends/postgresql_psycopg2/base.py", line
52, in execute
return self.cursor.execute(query, args)

DatabaseError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.



,
POST:,







...END ERRORS..

All of them do not depend by my code but by django/satchmo source
code, and never rise on developing serverbut the thing I don't
understand is paths I have no paths like them...Why it does
not give "page not found" but Errors ??
If i give that url in browser it correctly gives me "page not
found"

Thank you

Alkatron
-- 
You received this message because you are subscribed to the Google

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


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com.

To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


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


Mysterious errors message

2013-09-22 Thread kooliah

Everyday i receive 5-10 mysterious error messages of this kind

... ERRORS.

  File 
"../satchmo/satchmo/apps/satchmo_store/shop/context_processors.py", 
line 31, in settings

'shop_name': shop_config.store_name,

AttributeError: 'NoneType' object has no attribute 'store_name'


,
POST:,



  File 
".../satchmo/satchmo/apps/satchmo_store/shop/context_processors.py", 
line 31, in settings

'shop_name': shop_config.store_name,

AttributeError: 'NoneType' object has no attribute 'store_name'


,



  File "/django/db/backends/postgresql_psycopg2/base.py", line 52, 
in execute

return self.cursor.execute(query, args)

DatabaseError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.



,
POST:,







...END ERRORS..

All of them do not depend by my code but by django/satchmo source code, 
and never rise on developing serverbut the thing I don't understand 
is paths I have no paths like them...Why it does not give "page not 
found" but Errors ??
If i give that url in browser it correctly gives me "page not 
found"


Thank you

Kooliah

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


Mysterious error messages

2013-09-22 Thread kooliah

Everyday i receive 5-10 mysterious error messages of this kind

... ERRORS.

  File 
"../satchmo/satchmo/apps/satchmo_store/shop/context_processors.py", 
line 31, in settings

'shop_name': shop_config.store_name,

AttributeError: 'NoneType' object has no attribute 'store_name'


,
POST:,



  File 
".../satchmo/satchmo/apps/satchmo_store/shop/context_processors.py", 
line 31, in settings

'shop_name': shop_config.store_name,

AttributeError: 'NoneType' object has no attribute 'store_name'


,



  File "/django/db/backends/postgresql_psycopg2/base.py", line 52, 
in execute

return self.cursor.execute(query, args)

DatabaseError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.



,
POST:,







...END ERRORS..

All of them do not depend by my code but by django/satchmo source code, 
and never rise on developing serverbut the thing I don't understand 
is paths I have no paths like them...Why it does not give "page not 
found" but Errors ??
If i give that url in browser it correctly gives me "page not 
found"


Thank you

Kooliah

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


Re: iterating over a queryset?

2013-09-22 Thread kooliah

Sorry...I wanted open a new discussion but i reply instead...

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


Mysterious error messages

2013-09-22 Thread kooliah

Everyday i receive 5-10 mysterious error messages of this kind

... ERRORS.

  File "../satchmo/satchmo/apps/satchmo_store/shop/context_processors.py", 
line 31, in settings
'shop_name': shop_config.store_name,

AttributeError: 'NoneType' object has no attribute 'store_name'


,
POST:,



  File ".../satchmo/satchmo/apps/satchmo_store/shop/context_processors.py", 
line 31, in settings
'shop_name': shop_config.store_name,

AttributeError: 'NoneType' object has no attribute 'store_name'


,



  File "/django/db/backends/postgresql_psycopg2/base.py", line 52, in 
execute
return self.cursor.execute(query, args)

DatabaseError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.



,
POST:,







...END ERRORS..

All of them do not depend by my code but by django/satchmo source code, 
and never rise on developing serverbut the thing I don't understand 
is paths I have no paths like them...Why it does not give "page not 
found" but Errors ??

If i give that url in browser it correctly gives me "page not found"

Thank you

Kooliah

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


Re: Problem with DetailView

2012-07-07 Thread kooliah

On 07/07/2012 10:36 PM, Soviet wrote:
Now that I have basic understanding of models, I encountered even more 
confusing subjects - views and urls. Now, the class-generic views are 
quite easy to grasp at basic level, but I fail to understand what's 
wrong with this code:


urlpatterns = patterns('',
(r'^$', ListView.as_view(
model=Car,
context_object_name="cars_list",
template_name='data/cars_list.html',
)),
(r'^(?P\d+)/$', DetailView.as_view(
model=Car,
context_object_name="car_details",
template_name='data/car_details.html',
)),
)

The ListView is working fine, but when I try to get the details about 
single car, all I'm getting is error: "No car found matching the 
query". I tried adding 'queryset = Car.objects.all()' both in urls.py 
and in views.py, creating custom class, but the error persists.

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/fQZA1sl13VkJ.

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.
The parameters are from url and automatically passed to your view, i 
don't have to pass them explicitily, take a look on

https://docs.djangoproject.com/en/1.3//topics/http/urls/

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



SOLVED: Django 1.3 Admin Changelist column alignment

2012-06-18 Thread kooliah
I solved cloning and renaming the templatetag result_list (the rows 
builder) and modifying it.
It checks if the field is a number and set the class attribute  of the 
 tag to "numb", so using the admin css i can change alignment
Obviously i had to override change_list.html too to let it load my 
custom template tag.


It works, but i'm surprising that a so common functionality (everywhere 
numbers are right justify) needs a so complex customization..


I'm sure to have miss something and there is a simpler  way to do it...

If someone has better idea or solution i'm very happy to know

Thanks anyway to all



On 06/17/2012 02:55 PM, kooliah wrote:
I'm trying to change alignment of the number columns in the 
changelist, instead of default left alignment for all, i would like to 
have left for the text and right for the numbers.
Is it possible to do it in the admin.py overriding the default class 
or i have to make some filters and apply to the template?


Overriding i can change the format or the column displayed using a 
callable, so i tryed to rjust the number (converted to string and 
thousand separated) using a function but i think it is trimmed again 
later



Can someone point me in the right direction?

Thanks to all

Kooliah



--
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 1.3 Admin Changelist column alignment

2012-06-17 Thread kooliah
I'm trying to change alignment of the number columns in the changelist, 
instead of default left alignment for all, i would like to have left for 
the text and right for the numbers.
Is it possible to do it in the admin.py overriding the default class or 
i have to make some filters and apply to the template?


Overriding i can change the format or the column displayed using a 
callable, so i tryed to rjust the number (converted to string and 
thousand separated) using a function but i think it is trimmed again 
later



Can someone point me in the right direction?

Thanks to all

Kooliah

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



Re: no module named books found

2012-06-17 Thread kooliah

On 06/17/2012 06:23 AM, Sabbineni Navneet wrote:


It still shows the same error .
Do we have to create a database with that name before.
How do we check if i have the python-mysqldb package .
--
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.



Try
'ENGINE': 'mysql',

to check if mysqldb is installed, from python terminal

>>>import MySQLdb

if it will give you no errors, it's installed

--
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: image in browser

2012-06-14 Thread kooliah

Why don't you use staticfiles?

https://docs.djangoproject.com/en/dev/howto/static-files/

On 06/14/2012 08:15 AM, Satvir Toor wrote:

hello,

i wish to display the image into the browser through a template . I
used the following code to retrieve the image from Disk and send that
data to Html file

def my_image(request):
 image_data = open("/home/toor/Desktop/certificate/logo.png", "rb").read()
 return render_to_response('myapp/bio.html', {'img':image_data},
context_instance=RequestContext(request))


Now, The image is not availble into the html file that is displaying
in browser, Tell me where  I m wrong.


   


--
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: User registeration

2012-06-08 Thread kooliah

On 06/08/2012 01:06 PM, AJAYI THEOPHILUS wrote:


No the user has not been added the site has just been uploaded and new
user has been added i am testing trying to see how the registeration
page works one user registers successfully but subsequent user i try
to register return the exception   IntegrityError at /accounts/
register/
duplicate key value violates unique constraint
  "auth_user_username_key"
  DETAIL:  Key (username)=() already exists.

   
Try to check the auth_user table in the database to see if user already 
exists.


--
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: url_dir

2012-06-06 Thread kooliah

On 06/06/2012 12:32 PM, Satvir Toor wrote:

I installed a application source code downloaded from Internet .
Please explain me the following code that exists in urls.py file of
the project.
url(r'^pyrheology/plot/str/(?P\d+).png$',\
 'pyrheology.views.str_tmc_plot_img',\
 name='pyrheology-str-tmc-plot-img'),

   


https://docs.djangoproject.com/en/1.3/topics/http/urls/

--
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:SOLVED Admin filter sidebar problem

2012-06-05 Thread kooliah

Solved using custom filterspecs as said in:

http://djangosnippets.org/snippets/2261/



On 06/05/2012 07:27 PM, kooliah wrote:

Here me again :-)
I know that with django 1.4 there are custom filters, but i have to 
use 1.3 so


I have a model with a foreign key to another

class mdl1(models.Model):
color = models.ForeignKey(colors)
name = models.CharField(_("name"),

If in the admin.py i assign list_filter to color

class mdl1Admin(admin.ModelAdmin):
list_display = ('color','name')
list_filter = ('color',)


In the admin changeview filter sidebar it shows all the colors, not 
only those linked.

for example:

mdl1:

red:jonh
red:mike
red:frank
green:julia
green:jack


I would like to see in the sidebar only red and green not all the 
colors.


How can i do?

Thanks to all

Kooliah





--
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 filter sidebar problem

2012-06-05 Thread kooliah

Here me again :-)
I know that with django 1.4 there are custom filters, but i have to use 
1.3 so


I have a model with a foreign key to another

class mdl1(models.Model):
color = models.ForeignKey(colors)
name = models.CharField(_("name"),

If in the admin.py i assign list_filter to color

class mdl1Admin(admin.ModelAdmin):
list_display = ('color','name')
list_filter = ('color',)


In the admin changeview filter sidebar it shows all the colors, not only 
those linked.

for example:

mdl1:

red:jonh
red:mike
red:frank
green:julia
green:jack


I would like to see in the sidebar only red and green not all the 
colors.


How can i do?

Thanks to all

Kooliah



--
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: Sorl thumbnails VS Google

2012-06-05 Thread kooliah

That's what i'll do.

Thanks for the answer


On 06/04/2012 03:10 PM, fabrixxm wrote:

On 4 Giu, 12:32, kooliah<kool...@djeve.sites.djangohosting.ch>  wrote:
   

So i can't understand if i want to have a better ranking, it is better
to not use sorl for this kind of images and use



that gives


 

from a user perspective, I think is much wors load a full size image
and scale it down only to use its filename..

the same page you linked says also:

"
Create great alt text

The alt attribute is used to describe the contents of an image file.
It's important for several reasons:
  •It provides Google with useful information about the subject matter
of the image.
   We use this information to help determine the best image to return
for a user's query.
•Many people-for example, users with visual impairments, or people
using screen readers or who have
  low-bandwidth connections—may not be able to see images on web
pages.
  Descriptive alt text provides these users with important information.
"
so you should try to add a usefull alt alttrbute, like

  {% thumbnail pic.picture "280x280" as image %}
  
   {% endthumbnail %}

Which could render as




   


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



Sorl thumbnails VS Google

2012-06-04 Thread kooliah

May be it's a stupid question, but i can't find an answer.

Using sorl thumbnails and inspecting the page source i notice that 
images are coded in html in the following way:


width="187" height="280" />


but here

http://support.google.com/webmasters/bin/answer.py?hl=en=114016

"The filename can give Google clues about the subject matter of the 
image. Try to make your filename a good description of the subject 
matter of the image. For example, *my-new-black-kitten.jpg* is a lot 
more informative than *IMG00023.JPG*. Descriptive filenames can also be 
useful to users: If we're unable to find suitable text in the page on 
which we found the image, we'll use the filename as the image's snippet 
in our search results."


So i can't understand if i want to have a better ranking, it is better 
to not use sorl for this kind of images and use


height="{{ pic.picture.height }}" />


that gives
width="187" height="280" />


instead of

{% thumbnail pic.picture "280x280" as image %}


{% endthumbnail %}


Is this reasoning correct?

Thanks to all

Kooliah

--
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: SOLVED Django 1.3 Ordering by two or more fields workaround ??

2012-06-03 Thread kooliah

Solved working on admin instead of models, in the following way

- admin.py--
class SpecialOrderingChangeList(ChangeList):
'''
Django 1.3 ordering problem workaround
from 1.4 it's enough using ordering var
'''
def get_query_set(self):
queryset = super(SpecialOrderingChangeList, self).get_query_set()
return queryset.order_by(*self.model._meta.ordering)

class CollectionAdmin(admin.ModelAdmin):
list_display = ('collection_prdct','ordr', 'product')

def get_changelist(self, request, **kwargs):
return SpecialOrderingChangeList
end - admin.py--

Now the list_display of admin is ordered by all the fields in 
meta.ordering not only by the 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.



Re: Django 1.3 Ordering by two or more fields workaround ??

2012-06-03 Thread kooliah

On 06/03/2012 02:41 PM, kooliah wrote:


def _merged_field(self):
  return u'%s%i' % (self.collection_prdct, self.order)
merged_field = property(_merged_field)

and change
ordering = ('collection_prdct','ordr',)
to
ordering = ('merged_field',)

but it gives me
"ordering" refers to "mergedfield", a field that doesn't exist.


Sorry I mistake the pasted code the correct one is

def _mergedfield(self):
return u'%s%i' % (self.collection_prdct, self.ordr)
mergedfield = property(_mergedfield)% (self.collection_prdct, 
self.product)


class Meta:
ordering = ('mergedfield',)

Otherwise it would seem a stupid syntax 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.



Django 1.3 Ordering by two or more fields workaround ??

2012-06-03 Thread kooliah

I'm working on Satchmo, which last version require django 1.3,

http://www.satchmoproject.com/docs/dev/requirements.html

but with 1.3 there is an ordering problem as said here:

https://docs.djangoproject.com/en/dev/ref/models/options/#ordering

"Changed in Django 1.4: The Django admin honors all elements in the 
list/tuple; before 1.4, only the first one was respected."


So i have

-models.py-
class Collection(models.Model):
collection_prdct = models.ForeignKey(Product, verbose_name=_('Base 
Product'), related_name="test_cllctn", on_delete=models.PROTECT)
product = models.ForeignKey(Product, verbose_name=_('Collection 
Product'), on_delete=models.PROTECT)

qta = models.IntegerField(default=1, verbose_name=_('Quantity'))
discount = models.ForeignKey(Discount, verbose_name=_('Discount'))
ordr = models.IntegerField(_("Ordering"), default=0, 
help_text=_("Shipping order"))


def __unicode__(self):
return u"Coll.: %s - %s" % (self.collection_prdct, 
self.product)


class Meta:
ordering = ('collection_prdct','ordr',)
verbose_name = _('Collection model')
verbose_name_plural = _('Collection models')
end 
-models.py-


I think that i can do a callable that return a virtual merged field 
which order on...

something like

def _merged_field(self):
  return u'%s%i' % (self.collection_prdct, self.order)
merged_field = property(_merged_field)

and change
ordering = ('collection_prdct','ordr',)
to
ordering = ('merged_field',)

but it gives me
"ordering" refers to "mergedfield", a field that doesn't exist.

Do i miss something?...or
What is the best way to have it order by two or more fields, expecially 
in the admin list_view?


Thanks to all
Kooliah





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



Re: django connect alternate database.

2012-05-26 Thread kooliah

https://docs.djangoproject.com/en/dev/topics/db/multi-db/


On 05/26/2012 06:18 AM, Min Hong Tan wrote:

hi,

I have a situation.  currently i have one default django 's database.
but, i wound like to connect to mssql/other database.
- how can i get connected to ms-sql/other database?
- is it we have to create class in models? the database is for read only.
Hope able to get the information.

Regards,
MH
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


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



Re: Django site updater

2012-05-26 Thread kooliah

On 05/22/2012 10:17 PM, kooliah wrote:
I'm working on a new site and i have often the need to update the 
server to let other people see the progress.
I tought to do a python script that compare the file 
structure/date/time of my local version with the server version and 
update only the changed/new files.
Before starting, and according to the DRY principle :-), I would like 
to know if there is already something like that.



Tahnk you to everyone, i solved using git.
I made a remote git repository on the server to which i commit and push 
from local, then I open a ssh session and pull/fetch to deploing folder


Thanks again

--
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 site updater

2012-05-22 Thread kooliah
I'm working on a new site and i have often the need to update the server 
to let other people see the progress.
I tought to do a python script that compare the file structure/date/time 
of my local version with the server version and update only the 
changed/new files.
Before starting, and according to the DRY principle :-), I would like to 
know if there is already something like that.


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



SATCHMO: Access custom product fields

2012-05-14 Thread kooliah

I have a custom product model
--
from django.db import models
from django.utils.translation import ugettext_lazy as _
from product.models import Product

class alkBrand(models.Model):
brnd = models.CharField(_("Brand"), max_length=30, blank=False,
help_text=_("alk help"))
def __unicode__(self):
return 'alkBrand %s' % (self.brnd)
class Meta:
verbose_name = _('alk-Brand')
verbose_name_plural = _('alk-Brands')

class LocalProduct(models.Model):
product = models.OneToOneField(Product, verbose_name=_('Base Product'))
code = models.CharField(verbose_name=_('Code'), max_length=32, 
blank=True, null=True)

abrnd = models.ForeignKey(alkBrand)

def _get_subtype(self):  return 'LocalProduct'

def __unicode__(self):
if self.code:
return u"%s [%s]" % (self.product.name, self.code)
else:
return u'%s' % self.product.name

class Admin: pass

class Meta:
verbose_name = _('aBrand')
verbose_name_plural = _('aBrands')
--
I can't find a way to add records to LocalProduct.

If i try to write

brand = alkBrand.objects.get(brnd='mybrand')
ppp=Product.objects.get(id=2)
ppp.LocalProduct.add(abrnd=brand,code='gino')

gives me

DoesNotExist: LocalProduct matching query does not exist.

If i add that record with backend admin interface i have no problem to 
access that record in this way


ccc= ppp.LocalProduct.code



Thanks to all


--
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: Upload files without form

2012-05-08 Thread kooliah

As often happens to me, things are much less complicated than i figure out

I loose hours running after UploadedFile, HttpRequest, etc.
Finally, it was my fault, a wrong path

Using os.path.join(settings.MEDIA_ROOT, 'images') create a new tree from 
static folder


Using os.path.join(settings.MEDIA_URL, 'images') return '/static/images' 
that gives error (path does not exist) while using 'static/images' it 
works now



(it's a test command, in real example i will load name from a file 
passed by args)

--
from django.core.management.base import BaseCommand, CommandError
import os

ffiles = []
ffiles.append('/mnt/hostdir/project/fotoalkatron/SNC110.jpg')
ffiles.append('/mnt/hostdir/project/fotoalkatron/SNC111.jpg')
ffiles.append('/mnt/hostdir/project/fotoalkatron/SNC112.jpg')

class Command(BaseCommand):
def handle(self, *args, **options):
_upload_img()
def _upload_img(fname):
for fpathname in ffiles:
fname = os.path.split(fpathname)[1]
_dst= os.path.join( 'static/images', fname)
myfl = open(fpathname,'r')
cntn = myfl.read()
myfl.close()
fdst = open(_dst,'wb')
fdst.write(cntn)
fdst.close()
---


On 05/08/2012 01:19 AM, kooliah wrote:

I need to upload a list of images to a project.
I've found tons of pages about how to upload a file using a 
form...(that's clearly written on django official docs) :-)


But i need to do it by a custom django-admin command because i have to 
link theese files(900) to respective records in the project


I tryed with shutil.copy too, but it copies files and immediately 
delete it. i saw them by file manager in the right folder, but after 
1-2 seconds they disappeared.


So i have a list
f[1]='/path/to/source/image1.jpg'
f[2]='/path/to/source/image2.jpg'
f[3]='/path/to/source/image3.jpg'
.
.
f[n]='/path/to/source/imagen.jpg'

and i need to upload to

os.path.join(settings.MEDIA_ROOT, 'images')

Does someone already done it WITHOUT USING FORMS, or can help me...

Thanks to all

Alkatron



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



Upload files without form

2012-05-07 Thread kooliah

I need to upload a list of images to a project.
I've found tons of pages about how to upload a file using a 
form...(that's clearly written on django official docs) :-)


But i need to do it by a custom django-admin command because i have to 
link theese files(900) to respective records in the project


I tryed with shutil.copy too, but it copies files and immediately delete 
it. i saw them by file manager in the right folder, but after 1-2 
seconds they disappeared.


So i have a list
f[1]='/path/to/source/image1.jpg'
f[2]='/path/to/source/image2.jpg'
f[3]='/path/to/source/image3.jpg'
.
.
f[n]='/path/to/source/imagen.jpg'

and i need to upload to

os.path.join(settings.MEDIA_ROOT, 'images')

Does someone already done it WITHOUT USING FORMS, or can help me...

Thanks to all

Alkatron

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



SATCHMO - Brand vs Brand category - difference

2012-05-05 Thread kooliah
I'm not english mother language, so I can't understand the difference 
from brand and brand category, i googled very much but i can't find a 
clear example.


Can anyone make me a simple real example (shoes, books, hardware, 
wathever) of a product with brand and brand category, by words not by code.


Thanks to all

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



Satchmo product model ER graph?

2012-05-03 Thread kooliah

I need to import an already running database into a satchmo store.
I started to make an ER graph, as a reference for the fields mapping, by 
myself, but if someone had already done it, i'd like to save time.


Thanks to all

Kooliah

--
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: Satchmo store as an app of a django project

2012-03-15 Thread kooliah

On 03/15/2012 10:41 PM, Joel Goldstick wrote:

My settings won't work for you unless you put your files in the same
directories as I do.
   
I did, i change settings according to my strcture trying either relative 
than absolute path, but it does not solve the problem
I think it's some prefix to put somewhere because moving up of one 
folder (making "store" site root) everything is ok


Thanks

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



Re: Satchmo store as an app of a django project

2012-03-15 Thread kooliah

On 03/15/2012 09:22 PM, Joel Goldstick wrote:

I had problems similar to you with my static files. First, I am
assuming you are using v1.3 of Django?  V1.0 did this differently

Below is a snippet from my settings.py:

Django is doing some things I don't really understand, but in your
case I think you should add entries to the STATICFILES_DIRS tuple.
You should read carefully the django docs concerning static file
settings.  Its confusing -- at least to me.

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = os.path.join(PROJECT_PATH,'static/')

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/;
STATIC_URL = '/static/'

# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/;, "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'

# Additional locations of static files
STATICFILES_DIRS = (
 # Put strings here, like "/home/html/static" or "C:/www/django/static".
 # Always use forward slashes, even on Windows.
 # Don't forget to use absolute paths, not relative paths.
 os.path.join(PROJECT_PATH,'project_static'),
)
   

I have django 1.2.3, i try you settings but nothing change

Thanks anyway

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



Satchmo store as an app of a django project

2012-03-15 Thread kooliah

I'm trying to run a satchmo store as an app of a django project
I create a django project myprj (django-admin.py startproject myprj)

I create a satchmo store (clonesatchmo.py)
I copied settings.py and local_settings.py from myprj/store
I modify myprj/urls to have shop in the /store subfolder of site

code-
from django.conf.urls.defaults import *
import store.urls
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('', (r'^store/', include(store.urls)),)
---
Going to http://127.0.0.1:8000/store/ the shop starts but it does not 
find the css and all the static stuff


output
[15/Mar/2012 11:08:29] "GET /static/css/style.css HTTP/1.1" 404 1999
[15/Mar/2012 11:08:29] "GET 
/static/images/productimage-picture-dj-rocks-2_jpg_85x85_q85.jpg 
HTTP/1.1" 404 2128

---
So i try to copy the static dir from myprj/store/static to myprj/static 
but nothing change, the files are there but it does not find them.


There are some wrong link too

output
[15/Mar/2012 11:22:42] "GET /accounts/login/?next=/store/ HTTP/1.1" 404 1997
---
like it does not care of the "store" prefix

Do I miss something? I think some prefix to put somewhere

Thank to all

kooliah

--
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 rowset split

2011-08-29 Thread kooliah

With

recset = mydb.all()
len(recset)
2000

I would like to split into x rowset with the same attributes and methods 
but 2000/x records.


I tried slicing but gave me errors

Thanks to all

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



SOLVED Re: Render nested queryset in a template ?

2011-07-18 Thread kooliah

Thank you

On 07/18/2011 11:57 PM, Daniel Roseman wrote:

Op maandag 18 juli 2011 20:29:17 UTC+1 schreef kooliah het volgende:

I need to render a nested queryset in a template, a classic
father/son
structure like
publisher>dvds>renters,



in python code i can use this code:

code

---
pub= publisher.objects.get(publisherid=1)
for disk in pub.dvds_set.all():
 print disk.dvdsname
 for rent in disk.renters_set.all():
 print rent.rentersname

---

How can i do same things in a template ?
Can i call methods in a tag or i have to build a dictionary and
pass it
to template?

Thanks to all


You can do exactly that, except without the () brackets. You'll need 
to pass the `pub` object into the template context, but the for loops 
work fine within the template.

--
DR.
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Bm0QDiljOakJ.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


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



Render nested queryset in a template ?

2011-07-18 Thread kooliah
I need to render a nested queryset in a template, a classic father/son 
structure like

publisher>dvds>renters,

code 
---

class publisher(models.Model):
publisherid = models.IntegerField(primary_key=True)
publishername = models.CharField(max_length=135, blank=True)

class dvds(models.Model):
dvdsid = models.IntegerField(primary_key=True)
dvdsname = models.CharField(max_length=135,verbose_name='Corp.Name')
publisher_publisherid = models.ForeignKey(publisher, 
db_column='publisher_publisherid')


class renters(models.Model):
rentersid = models.IntegerField(primary_key=True)
rentersname = models.CharField(max_length=135, blank=True)
dvds_dvdsid = models.ForeignKey(dvds, db_column='dvds_dvdsid')
---

in python code i can use this code:

code 
---

pub= publisher.objects.get(publisherid=1)
for disk in pub.dvds_set.all():
print disk.dvdsname
for rent in disk.renters_set.all():
print rent.rentersname
---

How can i do same things in a template ?
Can i call methods in a tag or i have to build a dictionary and pass it 
to template?


Thanks to all

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