Skip to main content

Home/ interesting_sites/ Group items tagged groups

Rss Feed Group items tagged

pagetribe .

A tour of git: the basics - 0 views

shared by pagetribe . on 19 Feb 09 - Cached
  • ~ suffix
  • HEAD~
  • HEAD~2" refers to two commits back
  • ...19 more annotations...
  • refers to the previous commit
  • $ git log HEAD~3..
  • git show 13ed136b
  • git status" tells us that the current branch is "master"
  • It’s a little bit helpful to know that we’ve modified hello.c, but we might prefer to know exactly what changes we’ve made to it.
  • git diff
  • To set your name and email address, just use the following commands:
  • git config --global user.name "Your Name" git config --global user.email "you@example.com"
  • --author option to the “git commit”
  • a blank line, and then one or more paragraphs with supporting detail. Since many tools only print the first line of a commit message by default, it’s important that the first line stands alone.
  • git commit --amend
  • misspelling in it
  • It's worth emphasizing the value of minimal, independent commits. The smaller the changes are the more useful the history will be when actually using the history, not just viewing it.
  • Just run "git pull" everytime you want to pull in new changes that have landed in the upstream repository.
  • Again, you'll see that this precisely matches the final portion of the output from "git pull". Using "git fetch" and "git merge" let us achieve exactly what "git pull" did, but we were able to stop in the middle to examine the situation, (and we could have decided to reject the changes and not merge them---leaving our master branch unchanged).
  • For now, let's return back to the tip of the master branch by just checking it out again: $ git checkout master
  • $ git --bare init --shared The --shared option sets up the necessary group file permissions so that other users in my group will be able to push into this repository as well.
  • Now, generally the purpose of pushing to a repository is to have some "collaboration point" where potentially multiple people might be pushing or pulling.
  • git clone
pagetribe .

Django Tagging - 0 views

shared by pagetribe . on 18 Nov 08 - Cached
  • >>> tags = Tag.objects.usage_for_model(Widget, counts=True)
  • [('cheese', 1), ('house', 2), ('thing', 1), ('toast', 1)]
  •  
    def usage_for_model(self, model, counts=False, min_count=None, filters=None): """ Obtain a list of tags associated with instances of the given Model class. If ``counts`` is True, a ``count`` attribute will be added to each tag, indicating how many times it has been used against the Model class in question. If ``min_count`` is given, only tags which have a ``count`` greater than or equal to ``min_count`` will be returned. Passing a value for ``min_count`` implies ``counts=True``. To limit the tags (and counts, if specified) returned to those used by a subset of the Model's instances, pass a dictionary of field lookups to be applied to the given Model as the ``filters`` argument. """ if filters is None: filters = {} if min_count is not None: counts = True model_table = qn(model._meta.db_table) model_pk = '%s.%s' % (model_table, qn(model._meta.pk.column)) query = """ SELECT DISTINCT %(tag)s.id, %(tag)s.name%(count_sql)s FROM %(tag)s INNER JOIN %(tagged_item)s ON %(tag)s.id = %(tagged_item)s.tag_id INNER JOIN %(model)s ON %(tagged_item)s.object_id = %(model_pk)s %%s WHERE %(tagged_item)s.content_type_id = %(content_type_id)s %%s GROUP BY %(tag)s.id, %(tag)s.name %%s ORDER BY %(tag)s.name ASC""" % { 'tag': qn(self.model._meta.db_table), 'count_sql': counts and (', COUNT(%s)' % model_pk) or '', 'tagged_item': qn(self._get_related_model_by_accessor('items')._meta.db_table), 'model': model_table, 'model_pk': model_pk, 'content_type_id': ContentType.objects.get_for_model(model).pk, } extra_joins = '' extra_criteria = '' min_count_sql
  •  
    usage_for_model
1 - 4 of 4
Showing 20 items per page