Django developer required for full time job

2013-04-10 Thread Mo Mughrabi
Hello,

We are looking for a Django developer for a full time job in a start up,
the candidate must have work experience with Django. As a plus knowing the
below

   -

   Linux administration / setup
   -

   amazon cloud computing
   -

   RabbitMQ and Celery
   -

   South migration for Django
   -

   Bootstrap for HTML framework
   -

   Git and Github
   -

   PostgreSQL

The post is available for telecommute, you do not have to be in Kuwait.

If you are interested to apply, please share with us your résumé and asking
salary.

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




django 1.4 using locale urls

2012-09-02 Thread Mo Mughrabi
Hi, am stuck with trying to use locale urls and applying language prefix. I
tried to follow the manual but i guess i might have missed something, i
also tried posting a question on stackoverflow but no signs yet. Any one
can guide me, I would appreciate it.

http://stackoverflow.com/questions/12227271/url-locale-using-django-1-4

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



showing many-to-many field in admin interface

2012-08-09 Thread Mo Mughrabi
hello everyone,

am trying to build a single model that will be used for uploaded
images/files. Am trying to use it in the best way in the admin pages, so
when i associate it with a specific model as a many-to-many field it would
appear in a friendly way for users to upload images.

My attachment model is as following

class Attachment(models.Model):
_attachment_types = (
('I', ('Image')),
('P', ('PDF'))  ,
)

attachment_type = models.CharField(max_length=2, default='I')
description = models.TextField(null=True, blank=True)
file= models.FileField(upload_to='%Y/%m/%d')


my other model is

class LawCaseImage(models.Model):
bonanza = models.ForeignKey('LawCase')
image   = models.ForeignKey(Attachment)
primary_photo   = models.BooleanField(default=False)




class LawCase(models.Model):
"""  """
user_profile= models.ForeignKey(UserProfile,
limit_choices_to={'profile_type' : 'C'}, help_text=_('Only corporate
accounts will appear in the drop down.'))
name= models.CharField(max_length=20, )
description = models.TextField()
created_at  = models.DateTimeField(auto_now_add=True)
created_by  = models.ForeignKey(User, editable=False)
image   = models.ManyToManyField(Attachment, through=LawCaseImage)


I tried to use inline associate in my admin.py as following

class LawCaseImageForm(admin.TabularInline):
model = LawCaseImage


class LawCaseForm(admin.ModelAdmin):
inlines = [LawCaseImageForm, ]


but all i got was a grid with the many-to-many table. I would like to be
able to upload images right away when creating a new record and they will
be uploaded to attachment model and relation will be created on that base..

Is there a way to configure admin to work on that behavior? and if not, is
there a plugin out there i could use for that purpose?

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



reading external urls file and building reverse pattern

2012-03-06 Thread Mo Mughrabi
Hi,
Am stuck in building a function that would read from an external urlpattern
and generate a url, I've written a question and posted it here

http://stackoverflow.com/questions/9592332/django-read-urls-on-runtime-and-compile-reverse-output

if anyone can help, i would appreciate it a lot

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

2012-03-04 Thread Mo Mughrabi
I recommend django-piston, we've been using it and it's great and highly
capable

On Sun, Mar 4, 2012 at 9:13 PM, Bharath Mundlapudi wrote:

> Dear Django Users and Authors,
>
> I am wondering if there are any best practices or better way to write REST
> based apps on top of Django. I was using version 1.1 and not followed
> recent advancements. Can you kindly point me to links or references from
> your experience.
>
> Preferably out-of-the-box solutions.
>
> -Bharath
>
> --
> 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.



Searching for django developer

2012-01-29 Thread Mo Mughrabi
Hello,

We are searching for a django developer for full time job, he/she must be
very capable and ready to take over a full time job. Must have strong
django experience, postgres, django-gis, html, css, jquery.

Please contact me back as soon as possible to discuss details,

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



Searching for django developer with good experience in JQuery/CSS3 and Html

2012-01-14 Thread Mo Mughrabi
Hello,

I've been working with a team for the past 6 months on a project, the
project is designer on cloud computing, using django as our main framework,
rabbitmq and celery to handle transactions. We are currently, consist of
project lead and 3 developers.

We have a very high standard in coding, deployment and communication. We
are searching for an additional developer, who will help in a lot of UI
work, which will involve CSS, JQuery, and has good sense of design he could
be a beginner level in django/python would be enough, but if knows more,
the better :)

Please reply back to me with rate, portfolio and when can you start?


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



searching for a django developer for an online gig

2011-12-18 Thread Mo Mughrabi
hi,

am looking for a good django developer to help finish a site, we are a team
of two and we would like to increase the work force. Must have strong
communication skills, good knowledge with html, css and javascripting
(jquery).

We are using amazon was, celery, rabbitmq and social networking
integration. He/she must be comfortable designing html pages as part of
some deliveries.

Contact me back for more details,

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

2011-11-12 Thread Mo Mughrabi
Yes, definitely we accept offshore developers working from their countries.

On Sat, Nov 12, 2011 at 5:32 PM, Casey Greene wrote:

> He means, "are you interested in job applicants that are not on-site (i.e.
> people working remotely)?"
>
> Hope this helps,
> Casey
>
>
> On 11/12/2011 08:52 AM, mo.mughrabi wrote:
>
>> We are located in Kuwait as for the second question am not quite sure
>> what you mean.
>>
>> On Nov 12, 6:07 am, Russell 
>> Keith-Magee
>> >
>> wrote:
>>
>>> On Fri, Nov 11, 2011 at 9:49 PM, Mo Mughrabi
>>>  wrote:
>>>
>>>> Hello fellows django developers,
>>>>
>>> ...
>>>
>>>> Please email me back if you are interested and I could share more
>>>> details,
>>>> Best regards,
>>>>
>>>
>>> Hi Mo,
>>>
>>> Two very important details that you might want to share:
>>>
>>>  * Where is your company located?
>>>
>>>  * Are you interested in applicants that want to telecommute?
>>>
>>> Remember -- django-users is a mailing list with an international
>>> audience. Just saying "Who wants a job" isn't very helpful unless you
>>> are genuinely willing to hire anyone, anywhere.
>>>
>>> Yours,
>>> Russ Magee %-)
>>>
>>
>>
> --
> 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+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en<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.



Django Gig

2011-11-11 Thread Mo Mughrabi
Hello fellows django developers,

I've been developing with django for sometime now, building a website for
almost 6 months now. Am at a late stages and am getting stuck in a lot of
things related mostly to CSS, JS and some advance Django challenges. Am
looking for a django developer who's interested to work on this project,

Am expecting it might drag for another month or two, am looking for a full
time developer to be entirely dedicated for helping me finish pending
issues and tasks related to the project. Developer must be strong in the
following


   - Django
   - HTML/XHTML
   - CSS
   - JQuery and Javascripting
   - RabbitMQ and Celery for Django
   - WebServices


Please email me back if you are interested and I could share more details,

Best 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-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: Problem with file upload!

2011-09-02 Thread Mo Mughrabi
is there any error messages you seeing? or logged? does the file exists on
the filesystem?

On Fri, Sep 2, 2011 at 8:39 PM, Ludvig  wrote:

> Hello,
>
> Usually only read these posts so i hope i'm doing this right!
>
> Recently my file upload just stopped working, and i've no idea what
> i've changed. I noticed that request.FILES is empty so i've googled
> some and cant figured out my problem.
>
> My form looks like this
>
>
>
>
>
> and my code like this,
>
>
> class PhotoUploadView(FormView):
>template_name ="album/photo_upload.html"
>form_class = PhotoUploadForm
>def get_context_data(self,**kwargs):
>context =
> super(PhotoUploadView,self).get_context_data(**kwargs)
>context['user_info'] = self.request.user
>if 'upload_form' in kwargs:
>context['upload_form'] = kwargs['upload_form']
>else:
>context['upload_form'] = PhotoUploadForm()
>album = get_object_or_404(Album,id=self.kwargs['album_id'])
>context['album'] = album
>return context
>
>def form_valid(self,form):
>print 'kek'
>def post(self,*args,**kwargs):
>print self.request.FILES
>print self.request.raw_post_data
>if self.request.method == "POST":
>form =
> PhotoUploadForm(self.request.POST,self.request.FILES)
>if form.is_valid():
>photo = Photo()
>photo.title = form.cleaned_data['title']
>photo.summary = form.cleaned_data['description']
>photo.album = get_object_or_404(Album,id =
> kwargs['album_id'])
>photo.is_cover_photo = True
>path =
>
> self.generate_filename(self.request.FILES['photo'].name,self.request.user,kwargs['album_id'])
>destination = open(path,"wb+")
>for chunk in self.request.FILES['photo'].chunks():
>destination.write(chunk)
>destination.close()
>photo.imagePath = path
>photo.save()
>return
> self.render_to_response(self.get_context_data(upload_form=form))
>
>def generate_filename(self,filename,user,album_id):
>filename = os.path.splitext(filename)[1]
>return settings.MEDIA_ROOT + "/profiles/" + user.username +
> "/" + "albums/" + album_id + "/" + str(hashlib.md5(str(time.time() +
> user.id)).hexdigest()) + filename
>
>
> Also,  i'm a inexperienced programmer. Still only a hobby so be kind
> to me,
>
> 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.
>
>

-- 
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: Multiple Database Routing Based on Site

2011-09-02 Thread Mo Mughrabi
What I did is create an attribute in my models and called it

model.py
class Data(models.Model):
   # connection_name is my database name which points to the name from
settings.py
connection_name = "gis"

name = models.CharField(max_length=50)
area = models.IntegerField()

and created a router.py
class DbRouter(object):

"""A router to control all database operations on models in
the contrib.auth application"""

def db_for_read(self, model, **hints):
if hasattr(model,'connection_name'):
return model.connection_name
return None

def db_for_write(self, model, **hints):
if hasattr(model,'connection_name'):
return model.connection_name
return None

def allow_syncdb(self, db, model):
if hasattr(model,'connection_name'):
return model.connection_name == db
return db == 'default'


so, everytime for read or write operation it will check the model for
attribute connection_name and if not found it will use the default.

hope this will help,
cheers,

On Fri, Sep 2, 2011 at 1:23 PM, Kevin  wrote:

> The only solution I can directly think of, since the SITE_ID is in
> settings.py would be to use some python logic to determine the
> database for that site.
>
> eg.
> if SITE_ID == 1:
>   ...  Database settings for site 1 here ...
>
> Use an if-then like this in your settings.py.
>
> Now if what your going after is storing the SITE_ID in a user's
> profile and using that for routing, this will be more complex, as you
> will need to code a new databasebackend to perform the routing, and
> perhaps some middleware and an authbackend.
>
> Mind you, I haven't done much work on multiple databases, so these are
> just ideas on how I think it might be done.
>
> On Sep 1, 9:54 pm, Terribyte  wrote:
> > I had a kind of crazy idea and I wanted to bounce it off of some
> > people with a lot more django experience than I.
> >
> > Here's my scenario...
> >
> > I would like 1 code base, this code base services potentially hundreds
> > of businesses, each of which I want to have a copy of the same schema
> > but with data only relevant to that business.
> >
> > Basically my idea is the following
> > If the model is a Site object or User object, route to the default
> > database, otherwise route reads and writes to a database name I'll set
> > in the sites table.
> >
> > The trick is I need to set the SITE_ID for the current request, and
> > I'm not sure exactly When that should happen (after login of course),
> > or if this idea is even workable.
>
> --
> 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.



configuration field

2011-09-02 Thread Mo Mughrabi
Hi I have a table which every has TextField to store plain text. Am using
this field for configuration and putting there some XML to read later on.

The problem with my approach that the xml is not validated and the reading
operation can be exhausting to parse the xml every time. And since XMLField
types are obsolete. Is there an alternative? even as a third party? if
anyone can recommend anything, I would appreciate it.


regards,

mo

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



selecting all columns from a table (advanced query)

2011-05-05 Thread Mo Mughrabi
Hi,

I been trying to create a backward relation using queryset and the joining
is working fine, accept that its not including the other joined table in the
selected columns. Below is my models, queryset and query.__str__() print

class Main(models.Model):
slug   = models.SlugField()
is_active  = models.BooleanField(default=True)
site   = models.ForeignKey(Site)
parent = models.ForeignKey('self', blank=True, null=True,
limit_choices_to={'parent' : None})
class Meta:
unique_together = (("slug", "parent"))
def __unicode__(self):
return self.slug

class MainI18n(models.Model):
main= models.ForeignKey(Main)
language= models.CharField(max_length=2,
choices=settings.LANGUAGES)
title   = models.CharField(max_length=100)
label   = models.CharField(max_length=200, blank=True,
null=True)
description = models.TextField(blank=True, null=True)
disclaimer  = models.TextField(blank=True, null=True)
class Meta:
unique_together = (("language", "main"))
def __unicode__(self):
return self.title
class List(models.Model):
main= models.ForeignKey(Main)
slug= models.SlugField(unique=True)
is_active   = models.BooleanField(default=True)
parent  = models.ForeignKey('self', blank=True, null=True)

def __unicode__(self):
return self.slug
class ListI18n(models.Model):
list= models.ForeignKey(List)
language= models.CharField(max_length=2,
choices=settings.LANGUAGES)
title   = models.CharField(max_length=50)
description = models.TextField()
class Meta:
unique_together = (("language", "list"))
def __unicode__(self):
return self.title

and my queryset is

Main.objects.select_related('main',
'parent').filter(list__is_active=True, maini18n__language='en',
list__listi18n__language='en')

and this is what my query is printing

'SELECT `category_main`.`id`, `category_main`.`slug`,
`category_main`.`is_active`, `category_main`.`site_id`,
`category_main`.`parent_id`, T5.`id`, T5.`slug`, T5.`is_active`,
T5.`site_id`, T5.`parent_id` FROM `category_main` INNER JOIN
`category_maini18n` ON (`category_main`.`id` =
`category_maini18n`.`main_id`) INNER JOIN `category_list` ON
(`category_main`.`id` = `category_list`.`main_id`) INNER JOIN
`category_listi18n` ON (`category_list`.`id` =
`category_listi18n`.`list_id`) LEFT OUTER JOIN `category_main` T5 ON
(`category_main`.`parent_id` = T5.`id`) WHERE
(`category_maini18n`.`language` = en  AND `category_list`.`is_active` = True
 AND `category_listi18n`.`language` = en )'

anyone can help show columns from list and listi18n? I tried extra but It
doesn't allow me to pass things like category_list.*

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.



django queryset include more columns in select statement

2011-05-04 Thread Mo Mughrabi
Hi,

I been trying to create a backward relation using queryset and the joining
is working fine, accept that its not including the other joined table in the
selected columns. Below is my models, queryset and query.__str__() print

class Main(models.Model):
slug   = models.SlugField()
is_active  = models.BooleanField(default=True)
site   = models.ForeignKey(Site)
parent = models.ForeignKey('self', blank=True, null=True,
limit_choices_to={'parent' : None})
class Meta:
unique_together = (("slug", "parent"))
def __unicode__(self):
return self.slug

class MainI18n(models.Model):
main= models.ForeignKey(Main)
language= models.CharField(max_length=2,
choices=settings.LANGUAGES)
title   = models.CharField(max_length=100)
label   = models.CharField(max_length=200, blank=True,
null=True)
description = models.TextField(blank=True, null=True)
disclaimer  = models.TextField(blank=True, null=True)
class Meta:
unique_together = (("language", "main"))
def __unicode__(self):
return self.title
class List(models.Model):
main= models.ForeignKey(Main)
slug= models.SlugField(unique=True)
is_active   = models.BooleanField(default=True)
parent  = models.ForeignKey('self', blank=True, null=True)

def __unicode__(self):
return self.slug
class ListI18n(models.Model):
list= models.ForeignKey(List)
language= models.CharField(max_length=2,
choices=settings.LANGUAGES)
title   = models.CharField(max_length=50)
description = models.TextField()
class Meta:
unique_together = (("language", "list"))
def __unicode__(self):
return self.title

and my queryset is

Main.objects.select_related('main',
'parent').filter(list__is_active=True, maini18n__language='en',
list__listi18n__language='en')

and this is what my query is printing

'SELECT `category_main`.`id`, `category_main`.`slug`,
`category_main`.`is_active`, `category_main`.`site_id`,
`category_main`.`parent_id`, T5.`id`, T5.`slug`, T5.`is_active`,
T5.`site_id`, T5.`parent_id` FROM `category_main` INNER JOIN
`category_maini18n` ON (`category_main`.`id` =
`category_maini18n`.`main_id`) INNER JOIN `category_list` ON
(`category_main`.`id` = `category_list`.`main_id`) INNER JOIN
`category_listi18n` ON (`category_list`.`id` =
`category_listi18n`.`list_id`) LEFT OUTER JOIN `category_main` T5 ON
(`category_main`.`parent_id` = T5.`id`) WHERE
(`category_maini18n`.`language` = en  AND `category_list`.`is_active` = True
 AND `category_listi18n`.`language` = en )'

anyone can help show columns from list and listi18n? I tried extra but It
doesn't allow me to pass things like category_list.*

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: remove items from queryset for nested regrouping

2011-04-15 Thread Mo Mughrabi
Ok its solved now, I updated my nested regroup with the following

{% regroup dict by col_mapper as column_gr %}

{% for column in column_gr %}
{{ column.grouper }}
{% with column.list as groupr %}
{% regroup groupr by main_title as item_gr %}
{% for ggc in item_gr %}

{{ ggc.grouper }}
{% for i in ggc.list %}
{{ i.list_title }}
{% endfor %}

{% endfor %}

{% endwith %}
{% endfor %}

On Fri, Apr 15, 2011 at 4:39 PM, Mo Mughrabi  wrote:

> Hi,
>
> I've been working on a project that takes into consideration performance as
> the top priority therefore am trying to use single to queries at each page
> to collect all the needed information.
>
> Any who, I got to a point where I have one query set that need to be
> regrouped based on column (left, right, center) and then again regrouped
> based on title. The logic is working fine, but when the second regroup
> starts it will take the entire queryset meanwhile I only need to regroup
> items that are on the left or center..etc. so, I searched for functions to
> remove items from the queryset without hitting the database and only thing I
> could find was to build a custom template which is where I got stuck :)
>
>
> This is my query result
>
>
>  
> ++---++---++---+---+-++-+-+
> | col_mapper | list_title| main_title | list_slug | id | slug
>| is_active | site_id | id | domain  | name|
>
>  
> ++---++---++---+---+-++-+-+
> | L  | gadget| for sale   | gadget|  2 |
> for-sale  | 1 |   1 |  1 | example.com | example.com |
> | L  | furniture | for sale   | frnture   |  2 |
> for-sale  | 1 |   1 |  1 | example.com | example.com |
> | L  | engines   | for sale   | engines   |  2 |
> for-sale  | 1 |   1 |  1 | example.com | example.com |
> | L  | women seeking men | personals  | wsm   |  1 |
> personals | 1 |   1 |  1 | example.com | example.com |
> | L  | missed connection | personals  | misd-conn |  1 |
> personals | 1 |   1 |  1 | example.com | example.com |
> | L  | men seeking women | personals  | msw   |  1 |
> personals | 1 |   1 |  1 | example.com | example.com |
> | R  | massage   | services   | massage   |  3 | srvces
>| 1 |   1 |  1 | example.com | example.com |
> | R  | computers | services   | compters  |  3 | srvces
>| 1 |   1 |  1 | example.com | example.com |
>
>  
> ++---++---++---+---+-++-+-+
>
>
> In my template, I did something like this
>
> {% regroup dict by col_mapper as column_gr %}
>
> {% for column in column_gr %}
> {{ column.grouper }}
>
> {% regroup column.list by main_title as item_gr %}
> {% for i in item_gr %}
> {{ i }}
> {% endfor %}
> {% endfor %}
>
> The first regroup is working fine, but once it gets to the second regroup
> it regroups again the whole queryset while I want to only regroup where
> col_mapper is equal to col_mapper.grouper. I tried to build a custom tag,
> but most the approaches I know they will cause the queryset to hit the
> database again for filtering.
>
> Any suggestions?
>
>

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



remove items from queryset for nested regrouping

2011-04-15 Thread Mo Mughrabi
Hi,

I've been working on a project that takes into consideration performance as
the top priority therefore am trying to use single to queries at each page
to collect all the needed information.

Any who, I got to a point where I have one query set that need to be
regrouped based on column (left, right, center) and then again regrouped
based on title. The logic is working fine, but when the second regroup
starts it will take the entire queryset meanwhile I only need to regroup
items that are on the left or center..etc. so, I searched for functions to
remove items from the queryset without hitting the database and only thing I
could find was to build a custom template which is where I got stuck :)


This is my query result


 
++---++---++---+---+-++-+-+
| col_mapper | list_title| main_title | list_slug | id | slug
   | is_active | site_id | id | domain  | name|

 
++---++---++---+---+-++-+-+
| L  | gadget| for sale   | gadget|  2 |
for-sale  | 1 |   1 |  1 | example.com | example.com |
| L  | furniture | for sale   | frnture   |  2 |
for-sale  | 1 |   1 |  1 | example.com | example.com |
| L  | engines   | for sale   | engines   |  2 |
for-sale  | 1 |   1 |  1 | example.com | example.com |
| L  | women seeking men | personals  | wsm   |  1 |
personals | 1 |   1 |  1 | example.com | example.com |
| L  | missed connection | personals  | misd-conn |  1 |
personals | 1 |   1 |  1 | example.com | example.com |
| L  | men seeking women | personals  | msw   |  1 |
personals | 1 |   1 |  1 | example.com | example.com |
| R  | massage   | services   | massage   |  3 | srvces
   | 1 |   1 |  1 | example.com | example.com |
| R  | computers | services   | compters  |  3 | srvces
   | 1 |   1 |  1 | example.com | example.com |

 
++---++---++---+---+-++-+-+


In my template, I did something like this

{% regroup dict by col_mapper as column_gr %}

{% for column in column_gr %}
{{ column.grouper }}

{% regroup column.list by main_title as item_gr %}
{% for i in item_gr %}
{{ i }}
{% endfor %}
{% endfor %}

The first regroup is working fine, but once it gets to the second regroup it
regroups again the whole queryset while I want to only regroup where
col_mapper is equal to col_mapper.grouper. I tried to build a custom tag,
but most the approaches I know they will cause the queryset to hit the
database again for filtering.

Any suggestions?

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



question update: django auto filling some data based on model attribute

2011-01-20 Thread Mo Mughrabi
Any one? please, I been researching since yesterday

http://stackoverflow.com/questions/4725685/django-auto-filling-some-data-based-on-model-attribute

-- 
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 custom signals

2011-01-18 Thread Mo Mughrabi
Hi,

am having problem with django custom signals not being able to see signals
across application. I made a simple call in my

*core/signals.py*

  *  from django.dispatch.dispatcher import Signal*
*# Signal-emitting code... emits whenever a file upload is received*
*# *
**
*upload_recieved = Signal(providing_args=['data'])*
**
**
*def upload_received_handler(sender, data, **kwargs):*
*print 'upload received handler'*
**
*print 'connecting signal'*
*upload_recieved.connect(upload_received_handler)*

*in core/models.py*

   * import signals*
**
*[the model]*

*in blog/admin.py*

 *   from models import article, category, media *
*from django.contrib import admin*
*from libs.shared.core.tasks import Create_Audit_Record*
*from libs.shared.core import signals*
**
**
**
*class ArticleModelAdmin(admin.ModelAdmin):*
*def save_model(self, request, obj, form, change):*
*upload_recieved.send(sender=self, data='ddd')*
*instance = form.save()*
*return instance*
**
**
**
*admin.site.register(article, ArticleModelAdmin)*
*admin.site.register(category)*
*admin.site.register(media)*


this is what I did, but am getting an error in the runtime unable to see
upload_received function. any ideas?

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



templating best practices in django

2011-01-08 Thread Mo Mughrabi
Hi,

I'm wondering what would be the best practice for templating in django. I
plan on having a single theme in which heads and footers will almost be the
same across my project,

1. Should I great an app only for this purpose, in the sense, an app will
host a header and footer functions (methods) along with their views. Is that
the best practice?

2. my second question, if I am going to host a header somewhere centered. Is
it possible that I include or exclude certain css or js from the main
header?

3. Is there a django module that help organizing my js and css in a way?


4. last, what is django_compressor used for, I don't get the idea, If am
going to specify the paths to my js. Why does it combine them all in a
single file? does that make the loading faster?

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-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: i18n django models

2011-01-08 Thread Mo Mughrabi
Transmeta is much nicer and much simpler. I just installed it and I already
like the way it is designed,

I just ran into a small problem with the ./manage.py sync_transmeta_db not
working. Any idea how it can be solved?

Am just getting an unknown command,


Cheers,


On Sat, Jan 8, 2011 at 4:23 PM, Alessandro Pasotti wrote:

> 2011/1/8 Mo Mughrabi 
>
> This is not exactly what I need.
>>
>> this library is not done as per the common best practices for i18nlizing
>> data.
>>
>> All you have to do is declare an object (field) as an i18n field and the
>> engine takes care of the rest. This example you can see in java struct and
>> php symphony, when executing the equivalent for syncdb it will generate an
>> additional table which holds the i18n languages instead of creating columns
>> with prefixes and suffixes.
>>
>
> Hi,
>
> I've been using transmeta for a big project, I had to slightly adapt it to
> suit my needs but it works well and I found it an elegant solution.
>
> http://code.google.com/p/django-transmeta/
>
> some migration/maintenance commands are also available within the lib.
>
> --
> Alessandro Pasotti
> w3:   www.itopen.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.
>

-- 
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: i18n django models

2011-01-08 Thread Mo Mughrabi
This is not exactly what I need.

this library is not done as per the common best practices for i18nlizing
data.

All you have to do is declare an object (field) as an i18n field and the
engine takes care of the rest. This example you can see in java struct and
php symphony, when executing the equivalent for syncdb it will generate an
additional table which holds the i18n languages instead of creating columns
with prefixes and suffixes.

Having columns mapped to a specific language means modifying your table in
the future if you need additional languages. Meanwhile, if creating a one to
many relation with a specific table that holds only the variable in
different languages means you can add as many language support as you need,

Plus, when I went through polyglot it does override a lot
of crucial functions, adding up such plugin into a critical
production environment can be risky with very little information about it.


Any other solutions?



On Fri, Jan 7, 2011 at 6:25 PM, Marcos Moyano wrote:

> I've worked on/with this app
> https://github.com/Anue/django-polyglot/
>
> Hope it helps.
> Rgds,
> Marcos
>
> On Fri, Jan 7, 2011 at 12:20 PM, Mo Mughrabi wrote:
>
>> Hello,
>>
>> in my design there are some models where I need to store certain fields in
>> different languages. I was wondering if anyone has done it before? I saw
>> some django modules that help do model translations but some of them did not
>> work properly.
>>
>> Any best practices out there? below is my code
>>
>> *my model.py*
>>
>> class Lookup_I18n(models.Model):
>> i18n_code = models.CharField(max_length=5,
>> default=settings.LANGUAGE_CODE)
>> value = models.CharField(max_length=300)
>>
>> class Lookup(models.Model):
>>
>> purpose = models.CharField(max_length=10)
>> key = models.CharField(max_length=10)
>> value_i18n = models.ForeignKey(Lookup_I18n)
>> value = models.Field()
>>
>> class Meta:
>> unique_together = (('purpose', 'key'),)
>>
>>  --
>> 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.
>>
>
>
>
> --
> Some people, when confronted with a problem, think “I know, I'll use
> regular expressions.” Now they have two problems.
>
> Jamie Zawinski, in comp.emacs.xemacs
>
> --
> 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.



Including subfolders

2011-01-07 Thread Mo Mughrabi
Hi,

My project is getting quite large with so many apps, so i decided to create
a folder for libs/shared and folder for apps in which libs/shared will
contain all my generic libraries and apps will contain the project specific
apps.

I found the following

http://solutions.treypiepmeier.com/2009/01/08/keep-your-django-applications-in-a-subfolder/

and It did the job in enabling me to include apps. I just have to questions

1. How do create a tuple in my settings.py containing all the folders I need
to include (in my case libs/shared and apps) and in manage.py include them
without hard coding the folder names? It seems like the following function
does not take tuples and only accept strings

sys.path.insert(0, join(settings.PROJECT_ROOT, "apps"))

2. Will my code works when I move it to production using mod_wsgi?

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: Designing a workflow engine on Django

2011-01-07 Thread Mo Mughrabi
Hi Javier,

yeah I saw goFlow, it looks pretty nice. My only concern is the update, if
you go to

http://code.google.com/p/goflow/downloads/list

<http://code.google.com/p/goflow/downloads/list>you notice it has not been
updated since 2008 and that is worrying. I don't know if anyone is still
maintaining the code, if it will work with 1.2 django..

Any ideas of alternative solutions?


Regards,

On Fri, Jan 7, 2011 at 7:01 PM, Javier Guerra Giraldez
wrote:

> On Fri, Jan 7, 2011 at 10:09 AM, Mo Mughrabi 
> wrote:
> > If am reinventing the wheel and if there is such thing that has been
> > developed already, any one can suggest, I would be more than happy to go
> > through it.
>
> yes, there are a few ones around there.  (as i found after realizing
> that what i had just programmed was a workflow engine :-))
>
> one that seems ok is GoFlow (http://code.google.com/p/goflow/).  i
> haven't used it but read the API and code and plan to (soon?) replace
> my own with it.
>
>
> --
> Javier
>
> --
> 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.



creating apps inside sub folders

2011-01-07 Thread Mo Mughrabi
Hi,

am trying to organize some commonly used apps in my libs/shared folder
inside my project.

When I moved the file there, I just appended libs.shared.appname to the
INSTALLED_APP and it worked. but the views are not working, i noticed the
urls that needed to be appended as well. What else am missing?

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



i18n django models

2011-01-07 Thread Mo Mughrabi
Hello,

in my design there are some models where I need to store certain fields in
different languages. I was wondering if anyone has done it before? I saw
some django modules that help do model translations but some of them did not
work properly.

Any best practices out there? below is my code

*my model.py*

class Lookup_I18n(models.Model):
i18n_code = models.CharField(max_length=5,
default=settings.LANGUAGE_CODE)
value = models.CharField(max_length=300)

class Lookup(models.Model):

purpose = models.CharField(max_length=10)
key = models.CharField(max_length=10)
value_i18n = models.ForeignKey(Lookup_I18n)
value = models.Field()

class Meta:
unique_together = (('purpose', 'key'),)

-- 
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: Any Django framework command to freeze/wait/notify ?

2011-01-05 Thread Mo Mughrabi
Am not quite sure of your question, but I use celery to create jobs running
in the background, queue them and get their status.

http://celeryproject.org/


regards,

On Wed, Jan 5, 2011 at 10:21 AM, vivek_12315 wrote:

> Hi all,
>
> This is a common scenario which many of you have faced.
>
> Say, I created a simple view file, in which user uploads a file and
> does some processing at backend and after processing is finished I am
> rendering a html page with some processed result.
>
> My problem is that, there should be some kind of a mechanism, by which
> I can notify user that "processing is going in background, so please
> wait till the processing finished."
>
> So, what are the easy to implement options I have ? Does Django
> provides something for these scenario ? Will javascript (timer
> mechanism) work ?
>
> Comment/suggestions ?
>
> --
> 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.



Django, unobtrusive JavaScript and cross-site scripting

2011-01-03 Thread Mo Mughrabi
Hi,
am wondering if there is a manual/tutorial that talks about advance use
of JavaScripting and django, using existing frameworks such as JQuery or
Prototype, generating unobtrusive JavaScripting with no inline
Javascripting.

Another question, is there a place where I can read about cross-site
scripting and how I can protect my django project from such a thing?

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.