Skip to content

Bugfix "---------------" in projects dropdown list in reposr list view#349

Merged
kbeker merged 1 commit intomasterfrom
bugfix-project-dropdown-in-report-list
Jun 30, 2019
Merged

Bugfix "---------------" in projects dropdown list in reposr list view#349
kbeker merged 1 commit intomasterfrom
bugfix-project-dropdown-in-report-list

Conversation

@dybi
Copy link
Contributor

@dybi dybi commented Jun 26, 2019

resolves: #348

@dybi dybi added this to the next_release milestone Jun 26, 2019
@dybi dybi self-assigned this Jun 26, 2019
last_update = models.DateTimeField(auto_now=True)
author = models.ForeignKey(CustomUser, on_delete=models.PROTECT)
project = models.ForeignKey(Project, on_delete=models.CASCADE)
project = models.ForeignKey(Project, on_delete=models.CASCADE, blank=False, default=1)
Copy link
Contributor

@rwrzesien rwrzesien Jun 26, 2019

Choose a reason for hiding this comment

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

This is not correct solution for this. You have to set it on form directly by manually creating a field like this:

project = forms.ModelChoiceField(queryset=Project.objects, empty_label=None)

empty_label=None is the key here.

Copy link
Contributor

@rwrzesien rwrzesien left a comment

Choose a reason for hiding this comment

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

This is not correct solution unfortunately, using default=1 can lead to many problems because you point to ID of object that is not guarantee to exists (ie. on fresh installation or when removed).

@dybi dybi force-pushed the bugfix-project-dropdown-in-report-list branch from dd73c4d to b0c94f7 Compare June 28, 2019 09:00
@dybi dybi requested a review from rwrzesien June 28, 2019 11:28
@kbeker kbeker modified the milestones: v0.7.0, next_release Jun 28, 2019
@kbeker kbeker force-pushed the bugfix-project-dropdown-in-report-list branch from b0c94f7 to 5d431e0 Compare June 28, 2019 15:49
Copy link
Contributor

@kbeker kbeker left a comment

Choose a reason for hiding this comment

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

I think that after your fix is exactly how @rwrzesien proposed :) for me OK

Copy link
Contributor

@rwrzesien rwrzesien left a comment

Choose a reason for hiding this comment

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

Looks great now!

@kbeker kbeker merged commit 5d431e0 into master Jun 30, 2019
@kbeker kbeker deleted the bugfix-project-dropdown-in-report-list branch June 30, 2019 08:24
@kbeker kbeker added the bug Something isn't working label Jun 30, 2019
@kbeker kbeker modified the milestones: next_release, v0.7.2 Jul 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"-------------" in projects drop down list in report list

3 participants