Re: Packaging and development workflow for decoupled apps.

2011-03-11 Thread DaleB
I guess i wasn't clear enough. I am not so much concerned with when to
use tags and when to use branches.
I am still looking for a smooth development workflow.
I created a libs-dir which i put on my python path an put my different
apps in it.
Okay, now i can refer to my apps from any project without copying the
files. Great and a lot better than before.

So now i start to create different branches for an app, i create a
development branch an change stuff.
As the app is on my path my projects initially refer to the state/
branch of an app that ist currently checked out, right?
That's what i refered to by "switching branches" (= changing the
branch of my app in my libs-dir)

Another (better?) idea i had looking at pip's docs was to take my libs-
dir off the python path, put them in a git-repo and use pip to install
my app.
Pip's option to refer to certain tags and branches (http://
pip.openplans.org/requirement-format.html#version-control) seems
pretty ideal in this situation.
The only drawback i see is that i have to install and uninstall quite
often if i want to test different branches/states of my app in a
project.

And now i am not sure which route is more promising or if there's even
an easier way i don't regard at the moment.
Hope that's more clear.

Thanks fpr you patience,
Andreas

-- 
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: Packaging and development workflow for decoupled apps.

2011-03-11 Thread DaleB
Thank you for all your insights.

> I think you are stuck in the monolithic point of view.  I'm also not sure if
> you understand that django apps are python modules and the same rules apply.  
>
> The apps location within the PYTHONPATH is immaterial to a project, as long as
> the project can find the app. With this in mind, I tend to have a lib
> directory, that contains apps that are in development or checkouted out from
> other developers versioning system. This lib directory is added to the python
> path for each project that needs an app from this location. Please note this
> is a directory seperate from python${VERSION}/site-packages.

Indeed. With my shiny new installation package i totally forgot about
the fact that the package just needs no be on the path,
no matter where the files are actually stored. That really clears
things up for me.

And thanks for for your example Tom.

One last point.
Now, how do i deal best with different versions/branches of my app? Do
you just switch branches while developing or do you use pip in project
env to refer and switch to different tags/branches in your sourcecode.
The first approach feels more dynamic, the latter more 'stable'. In
the end i guess both work, but what do you do?

Greetings,
Andreas

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



Packaging and development workflow for decoupled apps.

2011-03-10 Thread DaleB
Hi all,

i could use some advice for a good packaging workflow.

So far i used to put an "apps"-folder in my project root and i stored
all individual apps in a sub-folder.
This works, but i thought: "Okay, try to decouple things a bit more
and try to create some 'real' reusable apps."

So i followed Jacob's guide on buildout (http://jacobian.org/writing/
django-apps-with-buildout) and thanks to the clear and detailed
instructions i managed to build a nice package for one of my apps.
Okay, so i removed the according sub-folder from my app-dir, installed
my new package to the virtualenv containing my project and everything
worked ... Nice!

BUT ...

I see that this is really great for the distribution of an app.
But what about development and "continuous packaging"?
I mean, my project consists of more than five apps. One side of me
would rather turn them all into installable packages so i get a nice
decoupled environment.

But how do i work on my projects once things are separated?
I mean, in reality, though functional distinct, the apps work together
and interact to form a site as whole.
So, to get a complete feeling and an overview for what my app does (or
breaks) i need to see it embedded in a working site.
I got this, when all different apps where folders under the same root-
dir. I could easily edit things in one app and see the results
immediately on my site. Due to version control it was easy to rollback
changes that were problematic.

Do i simply miss an important point? Am i just spilled by the
monolithic workflow?
How do you implement new features? Do you just concentrate on a single
app (in a separated buildout dir), test everything, package it and
finally install the new version and
then check if everything fits still together? (And if not, go back to
your app, package it again, install it etc.)

I'd really love to hear some strategies how you cope with this.

Thanks,
Andreas

-- 
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: Tracking changes of a model

2010-10-30 Thread DaleB
Hi Martin,

i think this should give you the basic idea:
http://stackoverflow.com/questions/1365963/diff-django-model-objects-with-manytomany-fields

Greetings,
Andreas

On 30 Okt., 12:15, Martin Tiršel  wrote:
> Hello,
>
> I am using Django admin to create/update some records. Now, I need to  
> track changes. After somebody updates a record, I need to see what was  
> changed and then create a text log like:
>
> changed `name`: oldvalue -> newvalue,
> changed `email`: o...@mail.xy -> n...@mail.xy
>
> Where is the right place, where I have access to unchanged model values  
> and validated values from the submit form? The place before the model is  
> updated by form values? Another approach would be to save all values into  
> a dictionary after the model is loaded from database and in save() method  
> compare old and new values, but I don't know how how to call a code after  
> load.
>
> Thanks,
> Martin

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



best way to build a form for m2m-related models (via intermediary table)?

2009-10-10 Thread DaleB

hi,

i am looking for an advice concerning django's forms and formsets.

i am creating a ticket system where the assignees and tickets are
associated via an intermediary table/model.

that's what the models basically looks like:

class Ticket(models.Model):
title = models.CharField('Titel',max_length=160)
assigned_to = models.ManyToManyField
('inventory.User',through='TicketAssignees', blank=True, null=True)

class TicketAssignees(models.Model):
user = models.ForeignKey('inventory.User')
ticket = models.ForeignKey('tracker.Ticket')
status = models.CharField
(max_length=1,choices=RoleChoices,blank=False,null=False)

the intermediary table seemed necessary to me, as i want so send
notifications (via signals) when an assignee is added to or removed
from a ticket.

what is the best way to build a form, that allows me to create a new
ticket?
using a standard modelform the 'assigned_to'-field is rendered as a
multiple choice-widget without the extra fields specified in the
intermediary model (status etc.)
okay, so i could build a custom form and add the missing fields
manually.
but does it make sense to include the fields of both models into the
same form?

i thought about creating an AssigneeForm for the TicketAssignees-Model
and tie it to a TicketForm (where i'd exclude the 'assigned_to'-field)
and glue both forms to new formset.
but as i learned, formsets are basically used to create multiple
copies of the same form.

then inline formsets came to my mind (especially as django's admin
allows to add m2m-related data as InlineAdmin) - but they are, as the
docs state, used for related foreign key data and not for related m2m
data.

what options am i overlooking?
the last thing that comes to my mind is the form wizard - but i am
sure there are simpler solutions ...
--~--~-~--~~~---~--~~
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: is it possible to limit the selectable content types/models for generic foreign keys?

2009-09-17 Thread DaleB

argh... just found this thread:
http://groups.google.com/group/django-users/browse_thread/thread/e87ad97774d005a4/d4f7df8e0afd08cf?lnk=raot=1

sorry for the duplication.

On Sep 17, 5:52 pm, DaleB <dal...@gmail.com> wrote:
> ahoi,
>
> is it possible to limit the choices for a generic foreign key the way
> you can do it for regular foreign keys?
>
> im a building a task-application where i need the possibilty to attach
> tasks to objects from certain classes (user, computers, departments).
> on the other hand i have a lot of classes my tasks don't have to deal
> with at all, so i'd like to exclude them form the list of content type-
> choices (in the admin widget).
> how would i do that?
>
> greetings,
> andreas
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



is it possible to limit the selectable content types/models for generic foreign keys?

2009-09-17 Thread DaleB

ahoi,

is it possible to limit the choices for a generic foreign key the way
you can do it for regular foreign keys?

im a building a task-application where i need the possibilty to attach
tasks to objects from certain classes (user, computers, departments).
on the other hand i have a lot of classes my tasks don't have to deal
with at all, so i'd like to exclude them form the list of content type-
choices (in the admin widget).
how would i do that?

greetings,
andreas

--~--~-~--~~~---~--~~
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: best way to format serialized data?

2009-07-28 Thread DaleB

Thanks for you answer Alex.

I'll definitely give your suggestions a go.
As i said, i am pretty new to ajax but i surely see your point.

So far i found a solution along the lines of this example:
http://www.nerdydork.com/django-djson-er-json.html
I iterated over my data, put the reformatted data in list and handed
the serialized list back to the template.
But still, having parts of presentational data in my template, that
can't be formatted or modified by django's template tags and filters
is somehow ugly.

So... i'll see where you examples lead me ;-)


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



best way to format serialized data?

2009-07-27 Thread DaleB

hi all,

i am just experimenting with ajax following the liveblog-example from
'python web development with django' (http://withdjango.com/).
everything works really good apart from the fact the i don't manage to
format the serialized data, that is returned by the ajax call:

 jQuery.each(data, function() {
update_holder.prepend(''
+ ''
+ this.fields.timestamp

basically i am trying to adjust the date, which is returned as full
date string (including (month, year etc.) to the rest of the template
where only the hour and the minutes of a postig are displayed.
so... django template-filters don't work and using python's strftime-
function on the returned data has no effect either?
do i have to format the date in my view? but then, how (and where) can
i 'reformat' the date?
the only thing that comes to my mind is copying the requested data to
a list, replace the date and then hand it over to the serializer...
but this is rather complicated, isn't it?

greetings,
andreas
--~--~-~--~~~---~--~~
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: Switching the sort order in a table (template) - Can you retrieve variables from the extra_context in a view function?

2009-06-16 Thread DaleB

Ups... sorry. I just solved it myself.
I overlooked the simple fact that i can use an if/else-construct based
on the extra_context in my template
So i don't have to access the context from a view at all.

Sometimes things are too simple ;-)


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



Switching the sort order in a table (template) - Can you retrieve variables from the extra_context in a view function?

2009-06-16 Thread DaleB

Hi all,

i am looking for solution to sort a table in a template:
Basically it's about switching between ascending and descending order.
My idea was to store the current sort order in the template's
extra_context (extra_context={'dir': sortdir,) and retrieve it from
there the next time i call the view.
Based on the set variable i could easily invert the sort-order .

Though this seems rather simple i couldn't find any information on how
to access the context from a view funtion? Is this possible at all?

Are there other good solutions (apart form js) to achieve what i am
trying to do?

Greetings,
Andreas


--~--~-~--~~~---~--~~
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 access and sort by data from intermediary tables in templates

2009-04-17 Thread DaleB

hi all,

i have a (probably quite simple) problem concerning the use of
intermediary tables.
i am trying to create a list of users.
users are members of different groups and within these groups they can
have several positions/status (e.g. management, staff member, e.g.).

my models look like this:

class Department
member = ManyToManyField('User', through='Membership',
blank=True,null=True)
...
class User
...

class Membership
StatusChoices = (
('m','Management'),
('s','Staff'),
user = ForeignKey('User')
department = ForeignKey('Department')
status = CharField(max_length=1,choices=StatusChoices)

what i am trying to achieve is a template that displays the following
information:

Department A
   Management
  User1
   Staff
  User2
  User3

Department B
   Management
  User4
   Staff
  User5
  User6

so i created a view which sends the group information to a template:
deps = Department.objects.all().select_related().order_by('name')
return object_list(request, queryset=deps...)

it's pretty easy to get the members for each group in the template
{% for m in object.member.all %}
{{ m.surname }}
{% endfor %}

i even manage to access the status of a user
 {% for m in object.depmembership_set.select_related %}
{{ m.status }}
 {% endfor %}

but somehow i don't get the pieces together, say, getting a view that
groups the users by their status (as sketched above) and displays all
the users detail  information (phone,email).

i wondering if i just miss some basic understanding of the way
django's templates work (accessing intermediary tables/related data)
or if the problem is more basic:
maybe i am sending insufficient data to the template (adding more data
via the context?)

any clues and hints are greatly appreciated.

andreas




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



contrib.comments - sort admin-list by last comment / display add-form inline ?

2009-02-13 Thread DaleB

hi all,

i have two questions concerning the comments module.
is it possible to include an field in the admin change list that
displays the last comment on a certain object and makes the list
sortable by 'last commented on'?
i think i read somewhere that you can't sort the admin list by foreign
keys and i am not exactly sure if this refers to the comment-module
too.

than i tried integrating the comments in my admin.py as inlines for
another class.
my aim is to display a comment form in the edit-form of another object
as i plan to use comments not strictly as comment-system but more to
make annotations (people will log what tasks they have performed with
an object) which will be done most of the time by admin-users.
trying to integrate a commentinlineadmin following the docs about how
to setup 'inlinemodeladmin objects' i ran into an error that stated
that no foreignkey is specified/existing on the comment-object.

so basically i am not sure, if i am just doing something wrong or if
the comments-module is simply not suited for my plans?

i hope the description is not too rough/general. for now i just need
to know if it makes sense to invest more work into make the comments
working the way i need them.

thanks!
andreas

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