Hi,

> On 18 Jun 2017, at 14.47, [email protected] wrote:
> 
> Hi Jani!
> 
> Am Sonntag, 18. Juni 2017 11:05:27 UTC+2 schrieb Jani Tiainen:
> Hi,
> 
> Seems that you've on right track. Just don't chew up too big bites.
> 
> Thanks! Good to know that I'm not completely wrong :-)
>  
> I suggest that first you start mapping your real world ideas to models. Don't 
> worry if you don't get it right at first try thats why migrations do exist.
>  
> That's where the first problem starts. Like I said I'm not that much familiar 
> with database stuff.

Well this has nothing actually to do with databases. ORM takes most of the 
troubles away. It helps though to learn a bit of SQL and how relational 
databases do work to understand if things go wrong.


> 
> Also test driven development model could work nicely.
> 
> That doesn't tell me anything :-( 
> I know what test driven development is, but don't understand the context with 
> this. 
>  

Well at some point you have some application logic, or business logic that you 
need to test. Currently your Project model is simple and doesn’t involve any 
real logic.


> Most of the things you describe are clienside operations and Django being 
> agnostic for that you're free to implement clientside as you wish.
> 
> You probably won't find much for similar project but there might be solutions 
> to individual problems.
> 
> Sadly in that example (http://blog.e-shell.org/130 
> <http://blog.e-shell.org/130>) it's not clear what to put where. Maybe you 
> can help me with that.
> 
> class Project(models.Model):
>     name = models.CharField('Name of the project', max_length=100)
>     code = models.CharField('Code number of the project', max_length=10)
>     creator = models.ForeignKey(User, related_name='created_projects')
>     maintainer = models.ManyToManyField(User, 
> related_name='maintained_projects')
> 
> That's easy:  polls\models.py which starts with 
> from django.db import models
> from django.contrib.auth.models import User
> 
> ("User" because of creator and maintainer)
> 
> But polls\forms.py is change several times.
> #from myproject.myapp.models import Project
> from .models import Project 
> class ProjectForm(forms.ModelForm):
>     class Meta:
>         model = Proyecto
> 
> Then
> #from myproject.myapp.models import Project
> from .models import Project
> from django.contrib.auth.models import Group
> 
> class ProjectForm(forms.ModelForm):
> 
>     creator_choices = [(c.id, c.username) for c in 
> Group.objects.get(name__icontains='creator').user_set.all()]
>     maintainer_choices = [(m.id, m.username) for m in 
> Group.objects.get(name__icontains='maintainer').user_set.all()]
> 
>     creator = forms.ChoiceField(required=True, label='Project creator', 
> choices=creator_choices)
>     maintainer = forms.MultipleChoiceField(required=True, label='Project 
> maintainer(s)', choices=maintainer_choices)
> 
>     class Meta:
>         model = Proyecto
> 
>  And then
> #from myproject.myapp.forms import ProjectForm 
> from .forms import ProjectForm
> from django.contrib.auth.models import Group
> 
> creator_choices = [(c.id, c.username) for c in 
> Group.objects.get(name__icontains='creator').user_set.all()]
> maintainer_choices = [(m.id, m.username) for m in 
> Group.objects.get(name__icontains='maintainer').user_set.all()]
> 
> creator = forms.ChoiceField(required=True, label='Project creator', 
> choices=creator_choices)
> maintainer = forms.MultipleChoiceField(required=True, label='Project 
> maintainer(s)', choices=maintainer_choices)
> 
> myform = ProjectForm()
> 
> myform.fields['creator'].choices = creator_choices
> myform.fields['maintainer'].choices = maintainer_choices
> 
> But here's "import ProjectForm" instead of import "Project" and "class Meta" 
> is missing.
> 

Now here is a lot of code that just can’t work as is. If possible, please 
publish your work in GitHub for example. Makes easier to follow your project 
and progress.

> Can you tell me what I did wrong? python manage.py makemigrations 
> <https://docs.djangoproject.com/en/1.11/ref/django-admin/#django-admin-makemigrations>
>  always can't find something (project, ProjectForm, ...), no matter what I'm 
> trying to change to resolve that error. I'm completely confused :-(
> Thank you!
> 

I also suggest that you hop in to your magnificent IRC channel. You’ll get 
(almost) instant help there.



> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/django-users 
> <https://groups.google.com/group/django-users>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/91a2c682-a360-49a5-80ad-d287da0e30e6%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/91a2c682-a360-49a5-80ad-d287da0e30e6%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/632DB7E9-6577-4DFF-8CEB-D41B3A890361%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to