-
Notifications
You must be signed in to change notification settings - Fork 209
Conversation
Again, address the first PR. Either close and reopen, or update. Also, when submitting PRs, please only do "pieces". You've put in settings, templates, urls, and media. But this PR is referring to dashboard models. |
from dashboard.models import Resource | ||
from dashboard.models import Tag | ||
from dashboard.models import Resource_Type | ||
from dashboard.models import CommunityPages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 3-8 are a little redundant. I would do:
from dashboard.models import (
SysterUser, Community, News, Resource, Tag, Resource_Type,
CommunityPages)
In addition to the comments I've left, I'd suggest to not put both BTW the default behavior is |
Ah nearly forgot - could you also put in tests? See @ana-balica 's pr #7 for example on how to setup tests for models. |
Can a tag be of more than 30 characters? Should I change it for tags also ? |
That makes sense, sure. |
return "{0} of {1} Community".format(self.title, self.community.name) | ||
|
||
|
||
class CommunityPages(models.Model): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it CommunityPage
(singular form) to be consistent with other models naming convention.
While working on permissions I have figured out we need a model to represent also community requests/proposals. |
Document sent to entire team. |
|
||
|
||
class SysterUser(models.Model): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a PEP8 error, but why did you add a blank line before class definition?
@dweep123 - a few things in addition to my comments: |
return self.name | ||
|
||
|
||
class Resource_Type(models.Model): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be ResourceType
- not snake cased.
@econchick , PR has been updated according to the comments above. |
@@ -5,3 +5,4 @@ flake8==2.1.0 | |||
psycopg2==2.5.3 | |||
django-cms==3.0 | |||
djangocms-text-ckeditor==2.1.6 | |||
django-countries==2.1.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to keep the requirements in alphabetical order, same as pip freeze
does.
Can you update that?
@ana-balica updated |
@@ -1,7 +1,8 @@ | |||
Django==1.6.5 | |||
Sphinx==1.2.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try running pip freeze
? It lists first the packages with uppercase and then those with lowercase.
So usually it outputs something like this:
Django==1.6.5
Sphinx==1.2.2
django-cms==3.0
[and so on]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now updated according to pip freeze :)
self.assertEqual(systeruser.blog_url, 'http://blog_url.com') | ||
self.assertEqual(systeruser.homepage_url, 'http://homepage_url.com') | ||
second_user = User.objects.create(username='user2', password='user2') | ||
second_systeruser = SysterUser.objects.create(user=second_user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
second_systeruser
is never actually used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
second_systeruser is corresponding syster user for second_user , It was created to check if the user entry is deleted then its corresponding syster user entry should also be deleted.
Hi @dweep123 - can you see https://travis-ci.org/systers/portal/ ? This PR fails the build, seen here. Please address all the flake errors. Otherwise, after the flake errors, this looks good. Ping me when this is updated and I will merge. (a simple @ will be fine) |
@econchick , updated |
@dweep123 add |
1 similar comment
@dweep123 add |
@econchick , updated. No flake8 errors now :) |
Thanks @dweep123. @ana-balica can you check Travis's failure? I was able to look it up and only see a secret key error - do you know what's going on? Once the Travis build passes I'll merge. |
@econchick I know what is the problem. Since we are using secure env, on PR from forked repos, travis is not including this data, hence the SECRET_KEY is missing and the build fails. More here. I will check if the workaround provided by travis works for us. |
Are we going to use slugs or ids for representing models in views? |
related_name='member_of_community') | ||
community_admin = models.ForeignKey(SysterUser, related_name='community') | ||
parent_community = models.ForeignKey('self', blank=True, null=True) | ||
website = models.URLField(max_length=30, blank=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
max_length
is rather short for URLs.
Same on lines 40, 41, 42.
Changed CommunityPages to CommunityPage Added tests for models deleted unwanted files Removed credentials Added tests for models Run flake8 Added tests for models Added tests for models Added tests for models Changed Line breaks Added tests for models Added Tests for models Added Tests for models requirements in alphabetical order Added Tests for models requirements in alphabetical order Added Tests for models Added tests for models Added tests for models Added tests for models Ignore never used flake8 errors Added slug field Added tests for models
@ana-balica @econchick updated.
This is more simple and we can define our own urls for these pages if we use the above model and also cms page model also provides a lot of other options which I guess we don't want. |
@dweep123 @ana-balica I think I understand placeholder fields, and if I understand correctly, switching to this would make sense. It sounds like you can extend the auth backend (here) just fine, although UserProfiles are deprecated in Django IIRC. @ana-balica what do you think? Also, you think you can help/work with Chitra re the auth permissions? Something to think about: having a WYSIWYG or a Markdown editor for the user-facing editable content. Folks will want to format the content, I'm assuming, and not want to write in pure HTML (I don't even know how Django/Django-CMS would handle the text) |
@econchick sure. But first it would be nice to review and merge what we have at the moment, since it becomes more and more complicated to work on new tasks which are dependent on pending PRs :) I suppose we want to achieve row level permissions. This is not complicated, we can have a decorator There are Django-CMS permissions, but I need to see how flexible are those and if they meet our needs. Recently I have discovered that tinymce, at last, has a decent theme, so we can use django-tinymce to provide a WYSIWYG editor. |
So this doesn't break the build (besides the secret key issue). I'm going to merge it so you both can continue on. |
This PR depends on the django-cms PR