Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

add dynamic mode for menu & translation file update #18

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

9nix00
Copy link
Contributor

@9nix00 9nix00 commented May 29, 2016

this pull request is add a feature that can make dynamic url and static url together.
e.g:

{% if item.is_dynamic %}
        <li><a href="{% url item.url %}">{{ item.title }}</a></li>
{% else %}
        <li><a href="{{ item.url }}">{{ item.title }}</a></li>
{% endif %}

@rossp
Copy link
Owner

rossp commented May 31, 2016

This needs the sample put into the README or other documentation, please. I think the name 'dynamic' is a bit confusing too - might want to make it clear that the URL being used is a Django URL name rather than a static piece of text.

@9nix00
Copy link
Contributor Author

9nix00 commented May 31, 2016

I will add example tomorrow.
about the field name. I agree with you. but I can't find a good name at now. maybe need_reverse is better or you can give me a suggestion? actually my english is very terrible...

@9nix00
Copy link
Contributor Author

9nix00 commented Jun 1, 2016

hi,@rossp. document update. please note in document, I add version number is 0.1.10.

should I change is_dynamic to need_reverse or other name?

@9nix00
Copy link
Contributor Author

9nix00 commented Dec 1, 2016

hi,@rossp. travis-ci looks broken.

for this PR, I need some help. I played django since 1.7. I tried generate south migration,but it's fail. it's too old,sorry.

can you generate south migration after this PR merged?

Worker information
hostname: travis-worker-gce-org-prod-4:f9e898dd-060f-447f-b9f8-09e689e6639e
version: v2.5.0 https://github.com/travis-ci/worker/tree/da3a43228dffc0fcca5a46569ca786b22991979f
instance: testing-gce-7da780ba-af3b-4b62-825f-852e93b37c92:travis-ci-ruby-precise-1471814219
startup: 21.332978663s
Could not find .travis.yml, using standard configuration.
Build system information
Build language: ruby
Build group: stable
Build dist: precise
Build id: 180295979
Job id: 180295980
travis-build version: dea9eba72
Build image provisioning date and time
Sun Aug 21 21:37:50 UTC 2016
Operating System Details
Distributor ID:	Ubuntu
Description:	Ubuntu 12.04.5 LTS
Release:	12.04
Codename:	precise
Linux Version
3.13.0-92-generic
Cookbooks Version
f77e708 https://github.com/travis-ci/travis-cookbooks/tree/f77e708
Git version
git version 1.8.5.6
bash version
GNU bash, version 4.2.25(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
GCC version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

LLVM version
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Pre-installed Ruby versions
ree-1.8.7-2012.02
ruby-1.8.7-p374
ruby-1.9.2-p330
ruby-1.9.3-p551
ruby-2.0.0-p648-clang
ruby-2.1.2
ruby-2.1.3
ruby-2.1.4
ruby-2.1.5
ruby-2.2.5
ruby-2.3.1
Pre-installed Node.js versions
v0.10.36
Pre-installed Go versions
1.4.2
mysql --version
mysql  Ver 14.14 Distrib 5.5.50, for debian-linux-gnu (x86_64) using readline 6.2
Pre-installed PostgreSQL versions
9.1.23
9.2.18
9.3.14
9.4.9
Redis version
redis-server 3.0.6
riak version
2.0.2
memcached version
1.4.13
MongoDB version
MongoDB 2.4.14
CouchDB version
couchdb 1.6.1
Neo4j version
1.9.4
Cassandra version
2.0.9
ElasticSearch version
1.4.0
Installed Sphinx versions
2.0.10
2.1.9
2.2.6
Default Sphinx version
2.2.6
Installed Firefox version
firefox 38.4.0esr
PhantomJS version
1.9.8
ant -version
Apache Ant(TM) version 1.8.2 compiled on December 3 2011
mvn -version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: /usr/local/maven
Java version: 1.7.0_80, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-92-generic", arch: "amd64", family: "unix"

$ export DEBIAN_FRONTEND=noninteractive
Reading package lists...
Building dependency tree...
Reading state information...
libc6 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 121 not upgraded.
$ git clone --depth=50 https://github.com/rossp/django-menu.git rossp/django-menu
Cloning into 'rossp/django-menu'...
remote: Counting objects: 168, done.
remote: Total 168 (delta 0), reused 0 (delta 0), pack-reused 168
Receiving objects: 100% (168/168), 32.89 KiB | 0 bytes/s, done.
Resolving deltas: 100% (67/67), done.
Checking connectivity... done.

$ cd rossp/django-menu
$ git fetch origin +refs/pull/18/merge:
remote: Counting objects: 50, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 50 (delta 19), reused 16 (delta 16), pack-reused 24
Unpacking objects: 100% (50/50), done.
From https://github.com/rossp/django-menu
 * branch            refs/pull/18/merge -> FETCH_HEAD

$ git checkout -qf FETCH_HEAD
$ rvm use default
Using /home/travis/.rvm/gems/ruby-2.2.5

$ ruby --version
ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-linux]
$ rvm --version
rvm 1.26.10 (1.26.10) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
$ bundle --version
Bundler version 1.12.5
$ gem --version
2.6.6
$ rake
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/home/travis/.rvm/gems/ruby-2.2.5/bin/ruby_executable_hooks:15:in `eval'
/home/travis/.rvm/gems/ruby-2.2.5/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)


The command "rake" exited with 1.

Done. Your build exited with 1.

menu/models.py Outdated
blank=True,
default=False,
help_text=_(u'Should this is a dynamic URL?')
help_text=_(u'Should Link URL need reverse?')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested help text: "Use URL resolver for this link? If False, this is treated as a literal URL.

menu/models.py Outdated
class Meta:
verbose_name = _(u'menu item')
verbose_name_plural = _(u'menu items')

def __unicode__(self):
return u"%s %s. %s" % (self.menu.slug, self.order, self.title)

def __str__(self):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

str is not requried if we are also creating unicode.

README.rst Outdated
@@ -15,7 +15,7 @@ Installation & Configuration:

1. ``pip install django-menu``

2. Add ``menu`` to your ``INSTALLED_APPS``
2. Add ``django.contrib.sites`` and ``menu`` to your ``INSTALLED_APPS``
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is contrib.sites still required?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants