Skip to content

#P08: Resources page setup#77

Merged
stefdworschak merged 8 commits intoCode-Institute-Community:masterfrom
irinatu17:resources_setup
Oct 23, 2020
Merged

#P08: Resources page setup#77
stefdworschak merged 8 commits intoCode-Institute-Community:masterfrom
irinatu17:resources_setup

Conversation

@irinatu17
Copy link
Contributor

@irinatu17 irinatu17 commented Oct 17, 2020

User Story ID:
#P08. As Participant, I would like to view useful resources and links.

Description of PR:
Adding Resources and Links page, that contains a table with names(or descriptions) of the resources and corresponding links that open in a new tab.

  • Resource model contains name(CharField) and link(URLField) fields.
    Note : the resources data can be loaded by using the following command: python3 manage.py loaddata resources
  • Resource view simply renders all the entities that exist in the model: resources = Resource.objects.all()
  • Template: on the medium and large screens resources' names and links are represented in the table. All the links are truncated by 50 characters: {{ resource.link|truncatechars:50 }}. On the smaller screens only resources' names are displayed (they are clickable, opening a link in a new tab) to achieve better UI and make it less cluttered.

Tests:

  • Manual tests were completed and passed (clicking on all links to ensure they open in a new tab and opens corresponding pages as expected)
  • Automated test were created for Resource model (checking that they can be created correctly and their string method), all passed - can be found in tests.py file in the resources app.
  • Responsiveness testing was implemented using Google Chrome's developer tools, everything looks as expected across all the different screen sizes.
  • Browser compatibility checked on Chrome, Edge and FireFox browsers.

Know bugs/errors:
Not found

Screenshots:
image1
image2

Copy link
Member

@stefdworschak stefdworschak left a comment

Choose a reason for hiding this comment

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

@irinatu17 I really like your changes here! I left a few minor comments; if you could make the few changes, that would be great!

Also, not sure why, but on my screen it seems that the table is a bit small. Maybe you can have a look at that as well. Here a screenshot (1920x1080):
Screenshot from 2020-10-18 00-34-09

Copy link
Member

Choose a reason for hiding this comment

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

I would move creating the Resource instances in the setUp method?
You can then reuse it also in your 2nd test case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if I've done that in a correct way, never used setUp() method before. Could you have a look, please?

Copy link
Member

Choose a reason for hiding this comment

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

That looks right to me!

Copy link
Member

Choose a reason for hiding this comment

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

Also when using .objects.create() you don't need to use .save(). The create method will automatically save it

Copy link
Member

Choose a reason for hiding this comment

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

Not sure you need to create an extra context dict here just for one key. I would just pass an {'resources': resources} into the render function directly.

Copy link
Member

Choose a reason for hiding this comment

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

Please properly indent the CSS here.

Copy link
Member

Choose a reason for hiding this comment

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

Please add a docstring here.

class Resource(models.Model):

name = models.CharField(max_length=254)
link = models.URLField(max_length = 200)
Copy link
Member

Choose a reason for hiding this comment

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

Do we only need these keys? I would suggest maybe to add a description as well to give an indication of what you would use each resource for.

@stefdworschak
Copy link
Member

One last suggestion, maybe as part of this Pull Request you could also add in the resources you had in your screenshot as a json file. You can dump the data from your database by using python3 manage.py dumpdata resources > resources.json

@stefdworschak
Copy link
Member

@irinatu17 just wanted to see if you have some time to look at my comments and make the suggested changes? No pressure at all if you don't have time. Just really like this PR and would be great if we could merge it 👍

@irinatu17
Copy link
Contributor Author

irinatu17 commented Oct 22, 2020

Hi @stefdworschak and @TravelTimN ! some changes are made, ready for another review!

Copy link
Member

@stefdworschak stefdworschak left a comment

Choose a reason for hiding this comment

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

LGTM

@irinatu17 thanks for all the changes! This looks great!

@stefdworschak stefdworschak merged commit 2d6c9a9 into Code-Institute-Community:master Oct 23, 2020
@stefdworschak stefdworschak added the hacktoberfest-accepted Accepted PR during Hacktoberfest label Oct 23, 2020
@irinatu17 irinatu17 deleted the resources_setup branch October 26, 2020 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted Accepted PR during Hacktoberfest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#S05. As Staff, I would like to view useful resources and links.

2 participants

Comments